tdm100
09-12-2006, 01:24 AM
I wrote code that utilizes 10 different UserForms.
At the Module Level I have two Sub Procedures.
One is the obligatory Show First UserForm and is initiated from a button on a worksheet.
The second Sub Procedure is not accessed unless it is called by one of the other nine UserForm Code (dependent on users action or input).
Generally, most UserForm Code ends with "prep" setting up the next UserForm.
for example from UserForm1 code
With frmUserForm2
.txtTextbox1.Text = info1
.txtTextbox2.Text = info2
.Show
End With
End Sub
It is possible during a user session to cycle through all UserForms 10 to 50 times.
I have discovered that when the session has concluded, I get the dreaded Hourglass Icon because the execution is going through all the code and executing all the accumulated "End Sub" Statements.
Including the very first Sub Procedure
Sub OpenFirstUserForm()
frmUserForm1.Show
End Sub
Which is usually the LAST End Sub statement Excel eventually executes.
After potentially fifty cycles, there are a lot of End Sub statements not being executed!
Only at the end of the session does all those End Subs get executed.
Thus, producing the Hourglass Icon.
Just my way of doing things, but anytime I write code that produces the Hourglass, that's kinda of an indicator to me that I aint doin something right or that maybe I am missing something!
But for the life of me I can't figure out how to end a procedure, particularly the very first one, until the user session has completed.
As far as I can tell, it's the nature of the beast, the way things are.
Correct?
~VBA tags ROCK!~
At the Module Level I have two Sub Procedures.
One is the obligatory Show First UserForm and is initiated from a button on a worksheet.
The second Sub Procedure is not accessed unless it is called by one of the other nine UserForm Code (dependent on users action or input).
Generally, most UserForm Code ends with "prep" setting up the next UserForm.
for example from UserForm1 code
With frmUserForm2
.txtTextbox1.Text = info1
.txtTextbox2.Text = info2
.Show
End With
End Sub
It is possible during a user session to cycle through all UserForms 10 to 50 times.
I have discovered that when the session has concluded, I get the dreaded Hourglass Icon because the execution is going through all the code and executing all the accumulated "End Sub" Statements.
Including the very first Sub Procedure
Sub OpenFirstUserForm()
frmUserForm1.Show
End Sub
Which is usually the LAST End Sub statement Excel eventually executes.
After potentially fifty cycles, there are a lot of End Sub statements not being executed!
Only at the end of the session does all those End Subs get executed.
Thus, producing the Hourglass Icon.
Just my way of doing things, but anytime I write code that produces the Hourglass, that's kinda of an indicator to me that I aint doin something right or that maybe I am missing something!
But for the life of me I can't figure out how to end a procedure, particularly the very first one, until the user session has completed.
As far as I can tell, it's the nature of the beast, the way things are.
Correct?
~VBA tags ROCK!~