Excel: Set focus to a ribbon on startup
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
https://i.stack.imgur.com/2YR3E.gif
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>