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
 
Back
Top