VBA auto hide ribbon in Excel 2013

前端 未结 7 2091
慢半拍i
慢半拍i 2020-12-14 12:13

How to Auto-hide Ribbon in Excel 2013 in VBA? I would like to achieve exactly what I get by clicking on the upper arrow icon at the right top of Excel menu mark

7条回答
  •  有刺的猬
    2020-12-14 12:17

    Give this a try:

    Sub ShowHideRibbon()
    
    If CommandBars("Ribbon").Controls(1).Height < 100 Then
        CommandBars.ExecuteMso ("MinimizeRibbon")
    Else
        CommandBars.ExecuteMso ("MinimizeRibbon")
    End If
    
    End Sub
    

    Or this:

    Sub ShowHideRibbon1()
    
    If Application.ExecuteExcel4Macro("Get.ToolBar(7,""Ribbon"")") Then
        Application.ExecuteExcel4Macro "Show.ToolBar(""Ribbon"", False)"
    Else
        Application.ExecuteExcel4Macro "Show.ToolBar(""Ribbon"", True)"
    End If
    
    End Sub
    

提交回复
热议问题