S
Sandy
I have the following but it does not run when closing workbook - Any ideas?
(I am assuming the message box should pop up?)
Private Sub Workbook_BeforeClose(Cancel As Boolean)
MsgBox "Hello"
Application.ScreenUpdating = False
Application.EnableEvents = False
Sheets("Current Round").Unprotect Password:="xxxxx"
Sheets("Current Round Detailed").Unprotect Password:="xxxxx"
Sheets("Current Round Graph").Unprotect Password:="xxxxx"
Sheets("Home Graphs").Unprotect Password:="xxxxx"
Sheets("Home Detailed Graphs").Unprotect Password:="xxxxx"
Sheets("All Rounds").Unprotect Password:="xxxxx"
Sheets("View Rounds").Unprotect Password:="xxxxx"
Sheets("Current Round").Visible = True
Sheets("Current Round Detailed").Visible = True
Sheets("Current Round Graph").Visible = True
Sheets("Home Graphs").Visible = True
Sheets("Home Detailed Graphs").Visible = True
Sheets("All Rounds").Visible = True
Sheets("View Rounds").Visible = True
Sheets("RecordOfRounds").Visible = xlSheetVeryHidden
Sheets("RecordOfRoundsDetailed").Visible = xlSheetVeryHidden
Sheets("HomeCourse").Visible = xlSheetVeryHidden
Sheets("HomeDetailed").Visible = xlSheetVeryHidden
Sheets("LogGraph1").Visible = xlSheetVeryHidden
Sheets("LogGraph2").Visible = xlSheetVeryHidden
Sheets("LogGraph3").Visible = xlSheetVeryHidden
Sheets("LogGraph4").Visible = xlSheetVeryHidden
Sheets("LogGraph5").Visible = xlSheetVeryHidden
Sheets("LogGraph6").Visible = xlSheetVeryHidden
Sheets("LogGraph7").Visible = xlSheetVeryHidden
Sheets("Current Round").Select
Dim Wksht As Worksheet
With Application
.DisplayFormulaBar = True
.CommandBars("Worksheet Menu Bar").Enabled = True
.CommandBars("Standard").Visible = True
.CommandBars("Formatting").Visible = True
.CommandBars("Drawing").Visible = True
End With
For Each Wksht In Worksheets(Array("Current Round", "Current Round
Detailed", _
"Current Round Graph", "Home Detailed Graphs", "Home Graphs", "All
Rounds", "View Rounds", "LogGraph3"))
Wksht.Activate
ActiveWindow.DisplayHeadings = True
Next
Application.ScreenUpdating = True
Application.EnableEvents = True
End Sub
Thanks
Sandy
(I am assuming the message box should pop up?)
Private Sub Workbook_BeforeClose(Cancel As Boolean)
MsgBox "Hello"
Application.ScreenUpdating = False
Application.EnableEvents = False
Sheets("Current Round").Unprotect Password:="xxxxx"
Sheets("Current Round Detailed").Unprotect Password:="xxxxx"
Sheets("Current Round Graph").Unprotect Password:="xxxxx"
Sheets("Home Graphs").Unprotect Password:="xxxxx"
Sheets("Home Detailed Graphs").Unprotect Password:="xxxxx"
Sheets("All Rounds").Unprotect Password:="xxxxx"
Sheets("View Rounds").Unprotect Password:="xxxxx"
Sheets("Current Round").Visible = True
Sheets("Current Round Detailed").Visible = True
Sheets("Current Round Graph").Visible = True
Sheets("Home Graphs").Visible = True
Sheets("Home Detailed Graphs").Visible = True
Sheets("All Rounds").Visible = True
Sheets("View Rounds").Visible = True
Sheets("RecordOfRounds").Visible = xlSheetVeryHidden
Sheets("RecordOfRoundsDetailed").Visible = xlSheetVeryHidden
Sheets("HomeCourse").Visible = xlSheetVeryHidden
Sheets("HomeDetailed").Visible = xlSheetVeryHidden
Sheets("LogGraph1").Visible = xlSheetVeryHidden
Sheets("LogGraph2").Visible = xlSheetVeryHidden
Sheets("LogGraph3").Visible = xlSheetVeryHidden
Sheets("LogGraph4").Visible = xlSheetVeryHidden
Sheets("LogGraph5").Visible = xlSheetVeryHidden
Sheets("LogGraph6").Visible = xlSheetVeryHidden
Sheets("LogGraph7").Visible = xlSheetVeryHidden
Sheets("Current Round").Select
Dim Wksht As Worksheet
With Application
.DisplayFormulaBar = True
.CommandBars("Worksheet Menu Bar").Enabled = True
.CommandBars("Standard").Visible = True
.CommandBars("Formatting").Visible = True
.CommandBars("Drawing").Visible = True
End With
For Each Wksht In Worksheets(Array("Current Round", "Current Round
Detailed", _
"Current Round Graph", "Home Detailed Graphs", "Home Graphs", "All
Rounds", "View Rounds", "LogGraph3"))
Wksht.Activate
ActiveWindow.DisplayHeadings = True
Next
Application.ScreenUpdating = True
Application.EnableEvents = True
End Sub
Thanks
Sandy