how cani create a pop up reminder when closing excel?

R

riley2007

i want to create a pop up window so when i x excel, it pops up like an error
message. so it says 'did you remember to update total of customers' with a
yes and return button. Please help me :D
 
M

Mike H

Hi,

Alt + F11 to open vb editor. Double click this workbook and paste this in

Private Sub Workbook_BeforeClose(Cancel As Boolean)
msg = "Did you remember to update total of customers?"
response = MsgBox(msg, vbYesNo)
If response = vbNo Then
Cancel = True
End If
End Sub

Mike
 
J

JW

Do you mean when you close a particular workbook? If so, open the
VBE, select the ThisWorkbook module and place this:
Private Sub Workbook_BeforeClose(Cancel As Boolean)
If MsgBox("Did you remember to update total " & _
"of customers?", vbYesNo) = vbNo Then Cancel = True
End Sub
 
Top