-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfrmProgBar.frm
48 lines (43 loc) · 1.24 KB
/
frmProgBar.frm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
VERSION 5.00
Begin {C62A69F0-16DC-11CE-9E98-00AA00574A4F} frmProgBar
ClientHeight = 1005
ClientLeft = 120
ClientTop = 465
ClientWidth = 6525
OleObjectBlob = "frmProgBar.frx":0000
StartUpPosition = 2 'CenterScreen
End
Attribute VB_Name = "frmProgBar"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
' Source: https://github.com/opi1101
Private Sub UserForm_Initialize()
Caption = ThisWorkbook.Name
lblBar.Width = 0
lblPerc = "0%"
lblProgName = vbNullString
lblCount = vbNullString
End Sub
Sub UpdateProgress(Current As Variant, Total As Variant, ProgName As String)
Dim p As Double
On Error Resume Next
p = Current / Total
On Error GoTo 0
Select Case True
Case p > 1
p = 1
Case p < 0
p = 0
End Select
lblBar.Width = lblBarScale.Width * p
lblPerc = Int(p * 100) & "%"
lblProgName = ProgName
lblCount = Round(Current, 2) & " / " & Round(Total, 2)
If Visible = False Then Show vbModeless
DoEvents
End Sub
Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
Cancel = (CloseMode <> VbQueryClose.vbFormCode)
End Sub