Hi,
In Book1 & Book2 i have the following code:
Private Sub Workbook_Activate
With Application
.ScreenUpdating = False
.ExecuteExcel4Macro "SHOW.TOOLBAR(""Ribbon"",False)"
.WindowState = xlMaximized
End With
End sub
Private Sub Workbook_Deactivate
With Application
.ExecuteExcel4Macro "SHOW.TOOLBAR(""Ribbon"",True)"
End With
I used the workbook_activate & deactivate event so that the user can have visible ribbon if switching to any other workbook.
However, when i open Book1 (hides ribbon as it should) then Book2 the ribbon becomes visible. Switching bewteen Book1 & Book2 does not hide the ribbon.
If i open Book1 (or Book2) only, then any other .xlsm the ribbon hides & unhides as it should when swithing between workbooks.
Can this be solved?
Thanks again
Mohamed
Hide/Unhide Excel Ribbon on Workbook Activate/Deactivate
-
- 3StarLounger
- Posts: 366
- Joined: 12 May 2010, 06:49
-
- Administrator
- Posts: 79317
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Hide/Unhide Excel Ribbon on Workbook Activate/Deactivate
Do you have other event code that might interfere? I copied your code (plus a line End Sub at the end) into the ThisWorkbook module of two workbooks, and the ribbon was hidden and unhidden as intended. When I switched from one workbook to the other, the ribbon was unhidden and hidden again in a fraction of a second.
Best wishes,
Hans
Hans