C
Charles
Hello
quick question on userforms. If I have in the following sub something
like
sub LaunchUserform
load userform1
userform1.show
end sub
what happens to the sub once the userform has been loaded and appeared
on the screen? Is the sub terminated? If not at what point does the
sub resumes?
Same thing when I want to unload the userform, from a sub within the
userform. Let's say that in one of the procedures contained in the
userform I have:
sub DoTheStuff
if me.TheValue=1 then
unload me
end if
msgbox "ok"
unload me
end sub
I have the feeling it doesn't always unload the userform after the
unload me, and that it doesn't interupt the sub DoTheStuff at unload
me (I am working on a much more complicated macro, so it's not as easy
to spot what's going on). How can I say both unload the userform and
exit the sub at the same time?
I don't know if this is related but I am also using a userform close
sub which closes a DAO link and cleans up:
Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As
Integer)
Is there a chance that this is interfering with how the userform can
be unloaded?
The reason I ask is that sometimes when the userform gives the feeling
it is done and gone, it looks like VBA is still active and the link to
the DB not close (and I can interrupt the code by using the Reset
button in VBA).
So my ultimate question is something like is there an ultimate/propper/
ultra clean syntax or steps to follow to deal with userforms and
loading/unloading them properly?
If anyone has some lights on the topic, would be greatly appreciated.
Thanks in advance
Charles
quick question on userforms. If I have in the following sub something
like
sub LaunchUserform
load userform1
userform1.show
end sub
what happens to the sub once the userform has been loaded and appeared
on the screen? Is the sub terminated? If not at what point does the
sub resumes?
Same thing when I want to unload the userform, from a sub within the
userform. Let's say that in one of the procedures contained in the
userform I have:
sub DoTheStuff
if me.TheValue=1 then
unload me
end if
msgbox "ok"
unload me
end sub
I have the feeling it doesn't always unload the userform after the
unload me, and that it doesn't interupt the sub DoTheStuff at unload
me (I am working on a much more complicated macro, so it's not as easy
to spot what's going on). How can I say both unload the userform and
exit the sub at the same time?
I don't know if this is related but I am also using a userform close
sub which closes a DAO link and cleans up:
Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As
Integer)
Is there a chance that this is interfering with how the userform can
be unloaded?
The reason I ask is that sometimes when the userform gives the feeling
it is done and gone, it looks like VBA is still active and the link to
the DB not close (and I can interrupt the code by using the Reset
button in VBA).
So my ultimate question is something like is there an ultimate/propper/
ultra clean syntax or steps to follow to deal with userforms and
loading/unloading them properly?
If anyone has some lights on the topic, would be greatly appreciated.
Thanks in advance
Charles