trevb
03-02-2010, 12:42 AM
Hi, can someone help please.....
I have entered the following code but for some reason when the No button is clicked nothing happens and I have to click it a second time to close the file, the Yes button works fine ?
Am I missing something really obvious ?
Any help much appreciated.
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Dim Ans As String
Ans = MsgBox("Do you want to save the workbook?", vbYesNo)
Select Case Ans
Case vbYes
ThisWorkbook.Save
Case vbNo
ActiveWorkbook.Close False
End Select
End Sub
Regards T
I have entered the following code but for some reason when the No button is clicked nothing happens and I have to click it a second time to close the file, the Yes button works fine ?
Am I missing something really obvious ?
Any help much appreciated.
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Dim Ans As String
Ans = MsgBox("Do you want to save the workbook?", vbYesNo)
Select Case Ans
Case vbYes
ThisWorkbook.Save
Case vbNo
ActiveWorkbook.Close False
End Select
End Sub
Regards T