Closing Userform

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello,

I am looking to run a macro whenever the userform is closed, whether by a
cancel button created by me or by clicking the red 'x'.

Thanks

Dave
 
That's what the UserForm_QueryClose and UserForm_Terminate event handlers
are for.

Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
''Allows cancelling close by setting Cancel = True
End Sub

Private Sub UserForm_Terminate()
''Runs after userform is terminated
End Sub

--
Jim
| Hello,
|
| I am looking to run a macro whenever the userform is closed, whether by a
| cancel button created by me or by clicking the red 'x'.
|
| Thanks
|
| Dave
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top