I have a macro that starts when the workbook is open that hides many of the headers and toolbars. It is great and works fine unless you are working on another workbook and need to see those headers and tool bars. Is there a way to display and hide those items per workbook and not for the entire application. here is my failed attempt:
Code
Sub show_excel_headers()
Dim wb As Workbook
Set wb = ThisWorkbook
wb.Application.ScreenUpdating = False
'Display Headings in all worksheets
Dim wsSheet As Worksheet
Dim sSheetStart
Set sSheetStart = ActiveSheet
wb.Application.EnableEvents = False
For Each wsSheet In Worksheets
wsSheet.Activate
ActiveWindow.DisplayHeadings = True
Next
sSheetStart.Activate
wb.Application.ScreenUpdating = False
wb.Application.EnableEvents = True
'Showing windows
ActiveWindow.DisplayHeadings = True
With wb.Application
.ShowStartupDialog = True
.DisplayFormulaBar = True
.DisplayStatusBar = True
.ShowWindowsInTaskbar = True
End With
wb.Application.CommandBars("Standard").Visible = True
wb.Application.CommandBars("Formatting").Visible = True
wb.Application.CommandBars("Worksheet Menu Bar").Visible = True
wb.Application.ScreenUpdating = True
End Sub
Display More
Code
Sub hide_excel_headers()
Dim wb As Workbook
Set wb = ThisWorkbook
wb.Application.ScreenUpdating = False
'Removing Display Headings
Dim wsSheet As Worksheet
Dim sSheetStart
Set sSheetStart = ActiveSheet
wb.Application.ScreenUpdating = False
wb.Application.EnableEvents = False
For Each wsSheet In wb.Worksheets
wsSheet.Activate
ActiveWindow.DisplayHeadings = False
Next
sSheetStart.Activate
wb.Application.EnableEvents = True
'Hiding toolbar stuff
ActiveWindow.DisplayHeadings = False
With wb.Application
.ShowStartupDialog = False
.DisplayFormulaBar = False
.DisplayStatusBar = False
.ShowWindowsInTaskbar = False
End With
'Hiding menu
wb.Application.CommandBars("Standard").Visible = False
wb.Application.CommandBars("Formatting").Visible = False
wb.Application.CommandBars("Drawing").Visible = False
wb.Application.CommandBars("Worksheet Menu Bar").Visible = False 'THIS IS ALSO SHOWING A BUG NOW - WHY?
wb.Application.ScreenUpdating = True
End Sub
Display More
Any help is appreciated.
Guy