-
Solved: Closing Excel by clicking the Red X
Hi guys.
I have a button that does some validation on a workbook, then closes Excel. What i would like; is that if the users clicks on the "Red Cross" (top right) in excel, that the same validation is run before closing excel - is this possible?
thanks
***************************
EDIT: Ok figured it out,
Put this code in the "Thisworkbook"
[VBA]Private Sub Workbook_BeforeClose(Cancel As Boolean)
If [your criteria] then
MsgBox "can't close now !!"
Cancel = True
endif
End Sub[/VBA]
Last edited by anthony20069; 10-06-2009 at 08:01 AM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules