Hi All,
My macros allow me to operate my spreasheet correctly now until I try to save the amended file using my spreadsheet menu or using the Excel window close and save options.
If I close without saving (either method) all works OK and the file can be reopened with macros enabled.
If I use the window close and save options, after some delay I get the error message 'File not Saved'.
If I save using my spreadsheet menu (using the same file name)the file apparently saves but when I reopen the file all macros are disabled and Excel locks up.
If I shut down excel and reopen it and then open the file with the Auto open macro disabled and subsequently other macros disabled, and then save the file again (same name) and then reopen the file with macros enabled all works OK again.
Can anyone help please - I have copied the relevant
VB code below.
Private Sub Workbook_Open()
Call Opener
End Sub
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Application.CommandBars("Reviewing").Visible = False
Worksheets("Opening").Activate
Range("A1").Select
Call ResetMenu
Application.CommandBars("standard").Enabled = True
Application.CommandBars("formatting").Enabled = True
Application.CommandBars("View").Enabled = True
Application.CommandBars("Tools").Enabled = True
Application.CommandBars("File").Enabled = True
Application.DisplayFormulaBar = True
Worksheets("Assumptions").Visible = xlSheetVeryHidden
Worksheets("Graph").Visible = xlSheetVeryHidden
Worksheets("Supplement").Visible = xlSheetVeryHidden
Worksheets("Gsupplement").Visible = xlSheetVeryHidden
Worksheets("Summary").Visible = xlSheetVeryHidden
Worksheets("Maintenance").Visible = xlSheetVeryHidden
Worksheets("Growth").Visible = xlSheetVeryHidden
Worksheets("Drought").Visible = xlSheetVeryHidden
Worksheets("Breeder").Visible = xlSheetVeryHidden
Worksheets("GandM").Visible = xlSheetVeryHidden
Worksheets("Table").Visible = xlSheetVeryHidden
Application.DisplayCommentIndicator = xlCommentIndicatorOnly
Application.CommandBars("Reviewing").Visible = False
Application.ScreenUpdating = True
End Sub
' Opener Macro
'
'
Sub Opener()
Application.DisplayCommentIndicator = 0
Application.ScreenUpdating = False
Application.CommandBars("standard").Enabled = False
Application.CommandBars("formatting").Enabled = False
Application.DisplayFormulaBar = False
Application.CommandBars("View").Enabled = False
Application.CommandBars("Tools").Enabled = False
Application.CommandBars("File").Enabled = False
Call FlapMenu
Worksheets("Assumptions").Visible = True
Worksheets("Graph").Visible = True
Worksheets("Supplement").Visible = True
Worksheets("Gsupplement").Visible = True
Worksheets("Summary").Visible = True
Worksheets("Maintenance").Visible = True
Worksheets("Growth").Visible = True
Worksheets("Drought").Visible = True
Worksheets("Breeder").Visible = True
Worksheets("GandM").Visible = True
Worksheets("Table").Visible = True
Application.ScreenUpdating = True
End Sub
' Closer Macro
'
'
Sub Closer()
Dim iReply As Integer
iReply = MsgBox("Close Save Changes or Close Without Saving Changes or Cancel and Return to Deer Feeding", vbYesNoCancel)
Select Case iReply
Case vbYes
ActiveWorkbook.Close True
Case vbNo
ActiveWorkbook.Close False
Case vbCancel
Call Opening
End Select
End Sub