Reputation: 175
I have a UserForm with a cancel button.
Sub DialogTest()
MyForm.Show
End Sub
Private Sub CancelButton_Click()
Unload Me
End
End Sub
I also tried MyForm.Hide
, End
by itself, cmdExit_Click
.
The cancel button does not close the dialog nor does it cause the debugger to come up.
Upvotes: 0
Views: 7311
Reputation: 14580
I was only able to replicate your issue when the Unload Me
Sub was pasted in a Worksheet or Module. When the Sub is in the Userform, it works fine.
Here, the code is pasted in a module and does not close the Userform
Instead, from VBE, double click on your UserForm, then double click on your Cancel Button.
Then paste the code here
Upvotes: 3