habe in einem Tab, wo eine längere Berechnung läuft.
Hier hätte ich gern einen Fortschrittsbalken.
Habe unter Hilfe das hier gefunden.
Bekomme es aber nicht hin, mein Makro mit einzubinden, das es gleichzeitig abläuft.
Die Makros:
Option Explicit
________________________________
Sub ShowDialog2()
Load ProgressDlg2 '1
ProgressDlg2.Show
End Sub
_______________________________________
Sub Main2() '4
Dim i As Long, tot As Long
Dim j As Long, totJ As Long
tot = 5000
totJ = 5
ProgressDlg2.Caption = "Progress Dialog Title"
For j = 1 To totJ
For i = 1 To tot
If i Mod 10 = 0 Then ProgressBar2 "Copying file " & j & " of " & totJ, j / totJ, "Writing record " & i & " of " & tot, i / tot
' do something
Next i
Next j
Unload ProgressDlg2
End Sub
______________________________________
Sub ProgressBar2(Msg1 As String, PctDone1 As Single, Msg2 As String, PctDone2 As Single)
With ProgressDlg2 '5
.lblMessage.Caption = Msg1
.lblDone.Width = PctDone1 * (.lblRemain.Width - 2)
.lblPct.Caption = Format(PctDone1, "0%")
.lblMessage2.Caption = Msg2
.lblDone2.Width = PctDone2 * (.lblRemain2.Width - 2)
.lblPct2.Caption = Format(PctDone2, "0%")
End With
'The DoEvents statement is responsible for the form updating
DoEvents
End Sub
************************
*************************
Userform
Option Explicit
------------------------------
Private Sub UserForm_Activate() '3
Call Main2
End Sub
_________________________
Private Sub UserForm_Initialize() '2
With Me.lblDone ' set the "progress bar" to it's initial length
.Top = Me.lblRemain.Top + 1
.Left = Me.lblRemain.Left + 1
.Height = Me.lblRemain.Height - 2
.Width = 0
End With
With Me.lblDone2 ' set the "progress bar" to it's initial length
.Top = Me.lblRemain2.Top + 1
.Left = Me.lblRemain2.Left + 1
.Height = Me.lblRemain2.Height - 2
.Width = 0
End With
End Sub
Wo müßte mein Makro eingefügt werden, damit es Zeitnah abläuft.
Gruß Angela