Hi there
I have written the following bit of code triggered off the workbook_before save event.
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
' Hide the UPS worksheet on the Workbook_BeforeSave event
If Sheets("UPS").Visible <> xlVeryHidden Then
Debug.Print "Sheets(""UPS"").Visible = "; Sheets("UPS").Visible
Sheets("UPS").Visible = xlVeryHidden
' For an unknown reason the previous line does not execute when the before_save event is triggered by a program.
'Debug.Print "Sheets(""UPS"").Visible = "; Sheets("UPS").Visible
End If
End Sub
Sub SaveIt()
ActiveWorkbook.Save
End Sub
The code is in the Thisworkbook object and works perfectly from the file save menu path or the save icon.
My problem is when another macro saves the workbook the
Sheets("UPS").Visible = xlVeryHidden
line does not execute.
Is this by design or have I found a bug? I am using Excel 2003.
Regards David
I have written the following bit of code triggered off the workbook_before save event.
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
' Hide the UPS worksheet on the Workbook_BeforeSave event
If Sheets("UPS").Visible <> xlVeryHidden Then
Debug.Print "Sheets(""UPS"").Visible = "; Sheets("UPS").Visible
Sheets("UPS").Visible = xlVeryHidden
' For an unknown reason the previous line does not execute when the before_save event is triggered by a program.
'Debug.Print "Sheets(""UPS"").Visible = "; Sheets("UPS").Visible
End If
End Sub
Sub SaveIt()
ActiveWorkbook.Save
End Sub
The code is in the Thisworkbook object and works perfectly from the file save menu path or the save icon.
My problem is when another macro saves the workbook the
Sheets("UPS").Visible = xlVeryHidden
line does not execute.
Is this by design or have I found a bug? I am using Excel 2003.
Regards David