How can I refer to the currently active userform?


Posted by Cory on August 11, 2001 12:58 PM

Is there some syntax I could user to refer to the currently active form rather than having to name it specifically? I would like to make a sub used by several close buttons on different forms rather than having to code each close button on each form...

Many thanks...

Cory

Posted by Ryan on August 11, 2001 7:05 PM

I think this is what you are asking:

Private Sub CloseButton_Click()
' Unload Current UserForm
Unload Me
End Sub

Or you can use this:
Private Sub CloseButton_Click()
' Hide Current UserForm
Me.Hide
End Sub

HTH
Ryan



Posted by Cory on August 12, 2001 9:18 AM

Brain fart..

Thanks, Ryan. As soon as I read your answer I had to kick myself. I already knew that, but for some reason it had slipped away...


Cory