I've got this VBA where when selecting a specific worksheet, it hides the ribbon. Although it works fine, it actually hides more than just the ribbon; it also hides the Quick Access Toolbar, which I need. Is there a way to exclude the Quick Toolbar? (examples below) Any help appreciated.
Ribbon hidden with VBA:
What I would like:
Current VBA I'm working with:
Private Sub Workbook_Activate()
If ActiveSheet.Name = "Mastersheet" Then
'Application.CommandBars.ExecuteMso "HideRibbon"
Application.ExecuteExcel4Macro "SHOW.TOOLBAR(""Ribbon"",False)" 'code to hide ribbon.
Else
Application.ExecuteExcel4Macro "SHOW.TOOLBAR(""Ribbon"",True)" 'code to show ribbon.
End If
End Sub
Private Sub Workbook_Deactivate()
Application.ExecuteExcel4Macro "SHOW.TOOLBAR(""Ribbon"",True)" 'code to show ribbon.
End Sub
Private Sub Workbook_SheetActivate(ByVal Sh As Object)
If Sh.Name = "Mastersheet" Then
'Application.CommandBars.ExecuteMso "HideRibbon"
Application.ExecuteExcel4Macro "SHOW.TOOLBAR(""Ribbon"",False)" 'code to hide ribbon.
Else
Application.ExecuteExcel4Macro "SHOW.TOOLBAR(""Ribbon"",True)" 'code to show ribbon.
End If
End Sub