0

I would like to toggle the Excel ribbon when Excel opens. For example, when Excel opens it always show the "Start" ribbon, but I want to set the another one "DeveloperTab" using VBA.

How to get the idMso for the excel ribbon?

aduguid
  • 3,099
  • 6
  • 18
  • 37
kavitha
  • 9
  • 2
  • Check out [this discussion](https://stackoverflow.com/a/19970060/4717755) to see if it sheds any light on your situation – PeterT Oct 16 '18 at 21:13

1 Answers1

0

I was able to do this with a class and a bit of XML. Here is the example file in GitHub. If you copy the .xlam file to %AppData%\Microsoft\Excel\XLSTART\ directory, every time Excel opens the Developer tab will get focus. To create create/edit the XML ribbon in Excel use Custom UI Editor Tool.

Example video

screenshot

Ribbon class

Option Explicit

Public Sub Ribbon_Load(ribbonUI As IRibbonUI)
On Error GoTo ErrTrap

    ribbonUI.ActivateTabMso ("TabDeveloper")

ExitProcedure:
    On Error Resume Next
    Exit Sub

ErrTrap:
    Select Case Err.Number
        Case Else
            Debug.Print "Error #: " & Err.Number & " |Error Description: " & Err.Description
    End Select
    Resume ExitProcedure
    Resume 'for debugging

End Sub

XML Code

<customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui" onLoad="Ribbon_Load">
    <ribbon>
    </ribbon>
</customUI>
aduguid
  • 3,099
  • 6
  • 18
  • 37