Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Workbook_beforeclose +msgbox
Thanks, Sharad, that helped a bit. Now Excel doesn't ask to save, bu the message box still pops up one more time after pressing "no". Phoeni -- Phoeni ----------------------------------------------------------------------- Phoenix's Profile: http://www.excelforum.com/member.php...nfo&userid=292 View this thread: http://www.excelforum.com/showthread.php?threadid=27038 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Workbook_beforeclose +msgbox
Insert a Module in the project. In the module just put following single line
to define a Public Variable 'norepeat' -x- Public norepeat As Integer -x- (Public variables must be defined at module level.) Then change the beforeclose code as under:- -x- Private Sub Workbook_BeforeClose(Cancel As Boolean) Dim UserResponse As String If norepeat = 1 Then Exit Sub UserResponse = MsgBox("Remember to HIDE and PROTECT. Do you want to save before closing?", vbYesNoCancel) If UserResponse = vbYes Then Me.Save End If If UserResponse = vbNo Then norepeat = 1 Me.Close SaveChanges:=False End If If UserResponse = vbCancel Then Cancel = True End If End Sub -x- Sharad "Phoenix" wrote in message ... Thanks, Sharad, that helped a bit. Now Excel doesn't ask to save, but the message box still pops up one more time after pressing "no". Phoenix -- Phoenix ------------------------------------------------------------------------ Phoenix's Profile: http://www.excelforum.com/member.php...fo&userid=2921 View this thread: http://www.excelforum.com/showthread...hreadid=270386 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Workbook_BeforeClose | Excel Discussion (Misc queries) | |||
Workbook_BeforeClose Question | Excel Worksheet Functions | |||
Workbook_beforeclose +msgbox | Excel Programming | |||
Workbook_BeforeClose | Excel Programming | |||
Workbook_BeforeClose | Excel Programming |