UserForm - display text message then run code

  • Thread starter Thread starter Robert
  • Start date Start date
R

Robert

I have a UserForm which runs some code for around 2 minutes. When the
CommandButton is activated I want a short message to display in a
TextBox on the UserForm throughout the time the code is running.
Even though 'TextBox1.Text = "selection running" is placed at the
beginning the message does not appear until all the process has finished
running.
Grateful for any suggestions.
 
Robert,

One way is to use the Status Bar at the bottom of the screen.
At various places within your code you can set different messages
Application.StatusBar = "Code processing begun"
Application.StatusBar = "2nd message"
......
Application.StatusBar = False ' this resets the Status Bar

Or you can use an extra sheet with a message on it.
In your code - show the window than use
Application.ScreenUpdating = False
to freeze the view (not the code).
Set it back to True at the end of your code (and besure to hide the sheet.

An alternate is to insert the sheet and than delete it. Or create another
workbook with a message page and than close it without saving.
use
Application.DisplayAlerts = False ' reset to true at the end
than close it without saving.

Just a couple of ideas to work with.

Post back if you want more input...
 
I have a UserForm which runs some code for around 2 minutes. When the
CommandButton is activated I want a short message to display in a
TextBox on the UserForm throughout the time the code is running.
Even though 'TextBox1.Text = "selection running" is placed at the
beginning the message does not appear until all the process has
finished running.
Grateful for any suggestions.

Many thanks for the suggestions - DoEvents has solved the problem.
 
Back
Top