S
st120869
I am using the code listed below, works perfect if I choose the chose
the spreadsheet i.e hides sheets, remove custom menu, problem is when I
select no to closing the workbook closes anyway but does not remove
custom menu.
Can anmyone help - I need to code to not close workbook when no
selected.
Thanks
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Dim Msg1, Style, Title, Response, MyString
Msg1 = "Do you want Close the PRISM Model ?"
Style = vbYesNo + vbCritical + vbDefaultButton2
Title = "Close Model"
Response = MsgBox(Msg1, Style, Title)
If Response = vbYes Then
MyString = "Yes"
For Each sht In ActiveWorkbook.Sheets
sht.Visible = 2
On Error Resume Next
Sheet13.Visible = xlSheetVisible
Next sht
CallMenu.resetWorksheet_Menu_Bar
Application.Quit
Else
MyString = "no"
End If
End Sub
the spreadsheet i.e hides sheets, remove custom menu, problem is when I
select no to closing the workbook closes anyway but does not remove
custom menu.
Can anmyone help - I need to code to not close workbook when no
selected.
Thanks
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Dim Msg1, Style, Title, Response, MyString
Msg1 = "Do you want Close the PRISM Model ?"
Style = vbYesNo + vbCritical + vbDefaultButton2
Title = "Close Model"
Response = MsgBox(Msg1, Style, Title)
If Response = vbYes Then
MyString = "Yes"
For Each sht In ActiveWorkbook.Sheets
sht.Visible = 2
On Error Resume Next
Sheet13.Visible = xlSheetVisible
Next sht
CallMenu.resetWorksheet_Menu_Bar
Application.Quit
Else
MyString = "no"
End If
End Sub