C
cdb
I have a workbook with an update button on (which has a macro behind it).
When I press this button I want a userform to open and display a flashing
message for the duration of the macro. I have tested all the bits seperately
and they all work fine - the update macro by itself works and updates the
data and the userform opens and display a flashing message if opened by
itself.
The problem I have is, if I put the userform into the update macro, once I
click the button the userform displays, but none of the code in the macro
works. I have tried adding the DoEvents code in but this doesn't seem to help.
Can anyone help me?
Code below
-------------------------------------------------------------------------------------------------
Sub UpdateData()
DoEvents
UserForm1.Show
~ My Code
UserForm1.Hide
End Sub
------------------------------------------
Private Sub UserForm_Activate()
Label1.Visible = False
StartLoop:
If Label1.Visible = False Then Label1.Visible = True Else Label1.Visible =
False
RunPause
GoTo StartLoop
End Sub
------------------------------------------
Sub RunPause()
PauseTime = 0.75 ' Set duration.
Start = Timer ' Set start time.
Do While Timer < Start + PauseTime
DoEvents ' Yield to other processes.
Loop
End Sub
When I press this button I want a userform to open and display a flashing
message for the duration of the macro. I have tested all the bits seperately
and they all work fine - the update macro by itself works and updates the
data and the userform opens and display a flashing message if opened by
itself.
The problem I have is, if I put the userform into the update macro, once I
click the button the userform displays, but none of the code in the macro
works. I have tried adding the DoEvents code in but this doesn't seem to help.
Can anyone help me?
Code below
-------------------------------------------------------------------------------------------------
Sub UpdateData()
DoEvents
UserForm1.Show
~ My Code
UserForm1.Hide
End Sub
------------------------------------------
Private Sub UserForm_Activate()
Label1.Visible = False
StartLoop:
If Label1.Visible = False Then Label1.Visible = True Else Label1.Visible =
False
RunPause
GoTo StartLoop
End Sub
------------------------------------------
Sub RunPause()
PauseTime = 0.75 ' Set duration.
Start = Timer ' Set start time.
Do While Timer < Start + PauseTime
DoEvents ' Yield to other processes.
Loop
End Sub