I have a VBA userform and I would like it to close if the user clicks the mouse anywhere (preferably anywhere on screen, but I'll take anywhere within the userform as a workable 2nd best option).
Here's my single line of code within the Userform_Click
subroutine, which is located in the userform code (not in a standard module, nor in 'this workbook', nor in a worksheet):
Private Sub UserForm_Click()
Unload Me
End Sub
The problem I have seems to be calling the UserForm_Click
subroutine. No matter where or how many times I click, it just never seems to be called. This seems like it should be so simple, but I must be missing something somewhere.
Apologies if this has been asked elsewhere, but I couldn't find an answer to this specific question in my searches.
BraX has solved it!
My userform is covered with a background image, so what I actually need to use is:
Private Sub Background_Click()
Unload Me
End Sub
Similiarly, for any other objects on the userform.
Thanks Brax!