Hi,
I have a little problem.
On opening of my WorkBook I refresh my PivotTable and that takes a while so while its refreshing. So I want to launch a UserForm that basically have a loop showing progress bar similar than the Windows loading bar (i.e. a set of green vertical green bars moving in a black rectangle).
Her is the code in THisWorkbook :
Private Sub Workbook_Open()
' On open refresh the Pivottables
'
Dim StopLoop As Boolean
Dim frmCursor As UserForm
Dim PT As PivotTable
Set frm = New frmCursor ' Here it loads the UserForm and starts the loop but it does not refresh
' my Pivot table... it never comes back to this macro to finish it
Sheets("RAW_DATA per resources").Select
Set PT = ActiveSheet.Cells.PivotTable
PT.RefreshTable
StopLoop = True
End Sub
...and here is the code in my UserForm :
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Public Sub UserForm_Initialize()
Dim MovCursor As Integer
StopLoop = False
Me.Show
Do Until StopLoop = True
For MovCursor = -10 To 270 Step 20
DoEvents
Me.Curseur.Left = MovCursor
Me.Repaint
Sleep 160
Next MovCursor
Loop
End Sub
I don't know what code to put where (UserForm, Workbook, etc..)
Can someone help me on this issue please.
Thank you for your help
Jean
Bookmarks