Warning Message Needed for User Who "X" Out of Certain Form

drmingle

Board Regular
Joined
Oct 5, 2009
Messages
229
I am attempting to have a pop message display when users of a certain form "X" out of the form. Below is what I came up with but it does not seem to be working:

Code:
Private Sub IntroUpdate_BeforeClose(Cancel As Boolean)
Call MsgBox("User closed the program before any formulas were updated.", vbExclamation, ".: ALERT: FM Program Tabs :.")
End Sub
Currently the above is in the code section of the form (titled: IntroUpdate).

Also if the form unloads I do not want the message displayed - only in the event that a user "X" out of the specific form titled: IntroUpdate).

Thanks as always for your help
 

AlphaFrog

MrExcel MVP
Joined
Sep 2, 2009
Messages
16,194
Try this...

Code:
[color=darkblue]Private[/color] [color=darkblue]Sub[/color] UserForm_QueryClose(Cancel [color=darkblue]As[/color] [color=darkblue]Integer[/color], CloseMode [color=darkblue]As[/color] [color=darkblue]Integer[/color])
    [color=darkblue]If[/color] CloseMode = 0 [color=darkblue]Then[/color]
        MsgBox "User closed the program before any formulas were updated.", _
               vbExclamation, ".: ALERT: FM Program Tabs :."
    [color=darkblue]End[/color] [color=darkblue]If[/color]
End [color=darkblue]Sub[/color]
Don't change the name of the procedure. It's required to be called UserForm_QueryClose
 
Last edited:

Forum statistics

Threads
1,085,859
Messages
5,386,386
Members
401,997
Latest member
cizwiz

Some videos you may like

This Week's Hot Topics

Top