Excel97: Show UserForm while running code?

  • Thread starter Thread starter Kozo Morimoto
  • Start date Start date
K

Kozo Morimoto

We still use Excel 97 at my place of work (don't ask).

I'd like to display a "Please wait while processing..." message (a UserForm
with an animated GIF) while the VBA is running and processing. Is this
possible to do? Whenever I do Form.show, the VBA code stops until I close
the UserForm. I really don't want to move all the code into the Form if
possible.
 
Hi

Demo: Put in a standard module:

Sub StartCode()
UserForm1.Show
End Sub

Sub MainCode(Optional B As Boolean)
Dim L As Long
For L = 1 To 5000
UserForm1.Caption = L & " of 5000"
UserForm1.Repaint
Cells(L, 1).Select
Cells(L, 1).Value = L
Next
Unload UserForm1
End Sub

And in the userform module:

Private Sub UserForm_Activate()
Me.Repaint
DoEvents
Call MainCode
End Sub

Animated Gif ? Not possible, sorry.

HTH. Best wishes Harald
 
Kozo said:
We still use Excel 97 at my place of work (don't ask).

I'd like to display a "Please wait while processing..." message (a UserForm
with an animated GIF) while the VBA is running and processing. Is this
possible to do? Whenever I do Form.show, the VBA code stops until I close
the UserForm. I really don't want to move all the code into the Form if
possible.
There is a hack:

http://xcelfiles.homestead.com/Excel01.html#anchor_22
 
You need to start the userform, then run your c ode, or initiate it, from
within the form. Then when it ends, close the form down.
 
Back
Top