Hi,
I'm developing some macro in an Excel file.
As one of these macro (when the user clicks on a button) requires 20 - 30 seconds of execution, I would like to create a "wait for" window for the user... The window is loaded and shown at the beginning and is unloaded at the end of the process.
In the Visual Basic Editor I right clicked in the VBA Project window, and I selected Insert -> UserForm (a UserForm1 has been created).
In this form I have put a simple label with caption "Wait for..." (nothing else).
At the beginning of Button1_Click, I inserted the statement:
Load UserForm1
UserForm1.Show
and, at the end:
UserForm1.Hide
Unload UserForm1
But the execution stops at UserForm1.Show statement (while I would like it executed the following code of the Button_Click procedure...)
I have read that there is a DoEvents statement that allows to bypass this problem: I have tried to insert it after UserForm1.Show statement, but no results, and then in the UserForm_Activate procedure, but also in this case no results...
Can you suggest me how to do it?
Thank you very much
I'm developing some macro in an Excel file.
As one of these macro (when the user clicks on a button) requires 20 - 30 seconds of execution, I would like to create a "wait for" window for the user... The window is loaded and shown at the beginning and is unloaded at the end of the process.
In the Visual Basic Editor I right clicked in the VBA Project window, and I selected Insert -> UserForm (a UserForm1 has been created).
In this form I have put a simple label with caption "Wait for..." (nothing else).
At the beginning of Button1_Click, I inserted the statement:
Load UserForm1
UserForm1.Show
and, at the end:
UserForm1.Hide
Unload UserForm1
But the execution stops at UserForm1.Show statement (while I would like it executed the following code of the Button_Click procedure...)
I have read that there is a DoEvents statement that allows to bypass this problem: I have tried to insert it after UserForm1.Show statement, but no results, and then in the UserForm_Activate procedure, but also in this case no results...
Can you suggest me how to do it?
Thank you very much