ryan_law2000
Well-known Member
- Joined
- Oct 2, 2007
- Messages
- 738
Hello, I have code that refreshes the workbook but I would like a loop to run during this time then when the refresh is complete close userform.
Push Button
Button Opens userform that runs a loop GIF.
Refresh All
When Refresh Complete close userform.
Any Ideas? Here is my current code. but the issue is the GIF will run but not until I close the userform then it refreshes the workbook.
Push Button
Button Opens userform that runs a loop GIF.
Refresh All
When Refresh Complete close userform.
Any Ideas? Here is my current code. but the issue is the GIF will run but not until I close the userform then it refreshes the workbook.
Code:
Sub Refresh()
With frmStatus
.Top = Int(((Application.Height / 2) + Application.Top) - (.Height / 2))
.Left = Int(((Application.Width / 2) + Application.Left) - (.Width / 2))
Load frmStatus
.Show vbModeless
'DoEvents
'Application.Run "RefreshData"
Unload frmStatus
End With
End Sub
Sub RefreshData()
ActiveWorkbook.RefreshAll
Unload frmStatus
End Sub
'loop
Private Sub UserForm_Activate()
Running = True
Call Animation
End Sub
Private Sub Animation()
Dim x As Integer
Dim y As Integer
Dim MyTimer As Double
DoEvents
x = 1
y = 1
MyTimer = Timer
Do
On Error Resume Next
frmStatus.Image3.Picture = LoadPicture _
("C:\Users\lawryad\Pictures\GEAR\GIF\a6632905e0-gif-im\" & x & ".Gif")
On Error GoTo 0
Do
Loop While Timer - MyTimer < 0.05
If x = 8 Then
x = 1
Else
x = x + 1
End If
If y = 11 Then
y = 1
Else
y = y + 1
End If
MyTimer = Timer
DoEvents
Loop While Running
End Sub
Private Sub UserForm_Initialize()
Application.WindowState = xlMaximized
End Sub
Last edited: