Hello,
The issue
On opening the file my code hides the:
Is it possible to limit the effects of the code to this single workbook in the VBA code itself? I can only think of a workaround by opening this file in a separate Excel-instance, but this has some serious disadvantages. Workbook_Activate & Workbook_Deactivate looked promising, but can't get it to work.
The current code on opening (some code omitted, it is in ThisWorkbook)
The current code on closing (some code omitted, it is in ThisWorkbook)
Some context
- I have scoured the web for people asking similar questions, got some results, but no real answer.
- I have made passive use of MrExcel and Ozgrid for a lot of issues, but this is my first post. I hope I am doing things right. This is not being crossposted. I will check up on this topic frequently.
Thank you for your time. Without communities such as these I would not be able to learn so much about Excel and VBA as I am now.
The issue
On opening the file my code hides the:
- ribbon
- formula bar
- status bar
- tabs
Is it possible to limit the effects of the code to this single workbook in the VBA code itself? I can only think of a workaround by opening this file in a separate Excel-instance, but this has some serious disadvantages. Workbook_Activate & Workbook_Deactivate looked promising, but can't get it to work.
The current code on opening (some code omitted, it is in ThisWorkbook)
Code:
Private Sub Workbook_Open()
Application.ExecuteExcel4Macro "SHOW.TOOLBAR(""Ribbon"",False)"
Application.DisplayFormulaBar = False
Application.DisplayStatusBar = Not Application.DisplayStatusBar
ActiveWindow.DisplayWorkbookTabs = False
End Sub
Code:
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Application.ExecuteExcel4Macro "SHOW.TOOLBAR(""Ribbon"",True)"
Application.DisplayFormulaBar = True
Application.DisplayStatusBar = True
ActiveWindow.DisplayWorkbookTabs = True
End Sub
- I have scoured the web for people asking similar questions, got some results, but no real answer.
- I have made passive use of MrExcel and Ozgrid for a lot of issues, but this is my first post. I hope I am doing things right. This is not being crossposted. I will check up on this topic frequently.
Thank you for your time. Without communities such as these I would not be able to learn so much about Excel and VBA as I am now.