View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Phoenix Phoenix is offline
external usenet poster
 
Posts: 1
Default Workbook_beforeclose +msgbox


Hi!

I'm using this code in "ThisWorkbook":

Private Sub Workbook_beforeclose(Cancel As Boolean)
Dim UserResponse As String

UserResponse = MsgBox("Remember to HIDE and PROTECT. Do you want t
save before closing?", vbYesNoCancel)
If UserResponse = vbYes Then
Me.Save
End If
If UserResponse = vbNo Then
Me.Close
End If
If UserResponse = vbCancel Then
Cancel = True
End If

End Sub


The problem is when i press "no". Then the box pops up twice....an
after pressing "no" twice excel asks again if i want to save. Why d
this happens?

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