Basic UserForm question - please help
Doug,
DoEvents is your keyword here. Keep in mind that it's not really running in
parallel.
Private blnExitSignal As Boolean
Private i As Long
Private Sub UserForm_Activate()
blnExitSignal = False
i = 0
Do Until blnExitSignal
i = i + 1
DoEvents
Loop
End Sub
Private Sub CommandButton1_Click()
blnExitSignal = True
MsgBox i
Me.Hide
End Sub
Rob
"Doug" wrote in message
...
Please help if you can. In my Excel macro, Sheet 1 determines if value 1
is greater than value 2 and if so, calls UserForm1. UserForm1 is a simple
form, with some text and an OK button. Clicking the OK button closes the
UserForm. So far, so good. When UserForm1 opens up, I need it to stay on the
screen until a user clicks the OK button. While it is up, I need the rest of
the macro to function. If I highlight UserForm1 and view code, I get my
code:
Private Sub UserForm1_Activate()
MsgBox "This is a test - hello"
'Place code here that or call another sub rotine from here
End Sub
Problem is, this refuses to show me the message box. What I am doing
wrong? Why won't the UserForm1_Activate() work?
Doug
|