Pop up message at closing

C

chanwando

I need to somehow get excel to "popup" a confirmation window when th
user attempts to close out. The message would be something along th
lines of "Is this the correct product?". If yes, excel would exit, i
not, then no.

I would really appreciate anyone who has the time/patience to assist m
with this.

Thank you!

Chandr
 
C

Chip Pearson

Chandra,

Put the following code in the ThisWorkbook code module:

Private Sub Workbook_BeforeClose(Cancel As Boolean)
If MsgBox("Is this correct?", vbYesNo) = vbNo Then
Cancel = True
End If
End Sub



--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"chanwando"
message
news:[email protected]...
 
C

chanwando

Thanks Chip! I really appreciate the help on this one!

Have a GREAT day!

Chandr
 
Top