Wait message using a Userform in vbModeless & Freeze mode
Sub waiting_message()
UserForm_progress.Show vbModeless 'Will display the userform andcontinue to execute this current code
UserForm_progress.Repaint 'Bug of Excel: the label on userform won't be shown in vbModeless without this code line
Application.ScreenUpdating = False 'Freeze
'Code with long calculation time
UserForm_progress.Hide
DoEvents 'To do events in a Freeze mode
Application .ScreenUpdating = True 'Unfreeze
End Sub
UserForm_progress.Show vbModeless 'Will display the userform and
UserForm_progress.Repaint 'Bug of Excel: the label on userform won't be shown in vbModeless without this code line
Application.ScreenUpdating = False 'Freeze
'Code with long calculation time
UserForm_progress.Hide
DoEvents 'To do events in a Freeze mode
End Sub
Code syntax: charles.racaud.free.fr
No comments:
Post a Comment