Originally Posted by
Dave
How about "Unload Me" code before the session ends.. or instead of hiding a userform before presenting another one, use "Unload Me" to exit each userform. This may be of no help but may be worth a trial. Dave
I appreciate your reply Dave.
All user forms have a command click sub that unload that particular userform.
within the code, the statement just prior to the "prep" "with end with" statements is the ---unload
Naturally, to unload the previous userform.
If you take a look at the very first sub in the sequence that's the only "Show" command that's not proceeded with an unload.
Puttin a unload statement behind the first Show command aint goin to help me much.
In fact it will result in a Compile error
[vba]
Sub OpenFirstUserForm()
frmUserForm1.Show
End Sub
'instead write it as...
Sub OpenFirstUserForm()
frmUserForm1.Show
Unload Me
End Sub
[/vba]
Even if it did work, by chance it did recognize that "Unload Me",
whatever input the user did on the now visible userform1, the execution will now take it to the Userform1 Code page.
That Unload Me wont get executed until the end of the session.
Which by then wont have nothing to unload.
Here's the situation:
[vba]
'Module1....................
Sub OpenFirstUserForm()
frmUserForm1.Show
'End Sub does not get executed until the end of session
End Sub
Sub ColorITnPostit(x As Integer, ParamArray pa() As Variant)
Windows("book1.xls").Activate
Sheets("sheet1").Select
'do dirty deeds to the info, color it and then post it on sheet one
'This End Sub always gets executed Immediately
End Sub
'frmUserForm1.......................
Private Sub cmdCancel_Click()
Unload Me
End Sub
Private Sub CommandButton1_Click()
FirstAction 1
'End Sub does not get executed Immediately
End Sub
Sub FirstAction(HitME)
TotActs = HitME
SomAry=array("Head","Chin","Cheek", "Nose)
Unload Me
ColorITnPostit HitME, SomAry
With UserForm2
.txtBox1.Text = TotActs
.Show
End With
'End Sub does not get executed Immediately
End Sub
'frmUserForm2................
Private Sub cmdCancel_Click()
Unload Me
End Sub
Private Sub CommandButton1_Click()
SeondAction 2
'End Sub does not get executed Immediately
End Sub
Sub SecondAction(HitME)
SomAry=array("Ear","Neck","Fist", "Eye")
FstActs = .txtBox1.Value
SecAct = HitME + 1
TotActs = FstActs + SecAct
Unload Me
ColorITnPostit SecAct, SomAry
With UserForm3
.txtBox1.Text = TotActs
.txtBox2.Text = FstActs
.txtBox3.Text = SecAct
.Show
End With
'End Sub does not get executed Immediately
End Sub
'Etc., Etc. for the othe UserForms up to ten
[/vba]
When the session ends,,, it will go back and HIT the End Subs it didnt execute