madhuchelliah
Board Regular
- Joined
- Nov 22, 2017
- Messages
- 226
- Office Version
- 2019
- Platform
- Windows
Hello Guys, the code i mentioned below is my userform code. If i show userform in between of my macro the macros stopped and showing userform alone. It is not continuing to the next macros. What is the reason for macros not continuing until i unload the userform? What i am missing here?
Code:
Option Explicit
Dim Running As Boolean
Private Sub CommandButton1_Click() 'Close
Application.EnableEvents = True
Unload Me
End Sub
Private Sub Image4_Click()
End Sub
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
SplashScreen.Image3.Picture = LoadPicture _
(ThisWorkbook.Path & "\Images\Animation\Flag\" & x & ".Gif")
SplashScreen.Image4.Picture = LoadPicture _
(ThisWorkbook.Path & "\Images\Animation\Pulser\" & y & ".Gif")
On Error GoTo 0
Do
Loop While Timer - MyTimer < 0.07
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
Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
Running = False
End Sub
Last edited: