Open the specified tab on the Ribbon when you start Excel

rediffusion

Board Regular
Joined
Apr 24, 2019
Messages
60
I added my add-in to Excel. Used "XML" to call from inside keytip="BP" and ******="ChooseTab". Running "MyExcelAddin.xlam" - It's WORK!
But! The fact is that after I go to the developer tab > Excel add-Ins = there I choose my add-in... When i open the add-in or any other Book, and boom doesn't WORK already! WTF I did not understand!?
Anyways does not work after setting the tick! ✅

Found on one portal StackOverflow, need to use "OnTime" instead of "Wait" or "Sleep". Seems like "Ontime" was not blocking the custom Ribbons from loading.
But I couldn't find the right code.

XML:

HTML:
<!--?xml version="1.0" encoding="UTF-8" standalone="yes"?--><customui xmlns="http://schemas.microsoft.com/office/2009/07/customui" on Load="ChooseTab">
    <ribbon startfromscratch="false">
        <tabs>
            <tab id="mytab_1" label="My Macros" keytip="BP">
                <group id="Sheets" label="Листы">
                    <button
                        idMso="About"
                        label="Show About"
                        screentip="Bla bla bla"/>
            </button
</group></tab>
        </tabs>
    </ribbon>
</customui>

VBA:

Code:
 ' (component: customUI, atribut: ******), 2010
Sub [B][COLOR=#2F4F4F]ChooseTab[/COLOR][/B](ribbon As IRibbonUI)
    SendKeys "%BP{F6}"
End Sub

P.S. :
"Office 2019"
"Microsoft Windows 10 Enterprise 2016 LTSB"
 
Last edited by a moderator:

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.
!! Also if you have «Microsoft Office 365 2019» this code works well:

Sub RibbonTab_******(ribbon As IRibbonUI)<code style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; font-family: Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace, sans-serif; vertical-align: baseline; box-sizing: inherit; white-space: inherit;"> ribbon.ActivateTabMso "TabFormulas"
End Sub</code>
 
Last edited:
Upvote 0

<code style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; font-family: Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace, sans-serif; vertical-align: baseline; box-sizing: inherit; white-space: inherit;">SubOpenMyTab(ribbon AsIRibbonUI)'Starts during `Sheet` loading (event occurs after AutoOpen and everything else).
ribbon
.ActivateTab"Tab1"'Write here the ID of the tab (which is written in XML).
' ribbon.ActivateTabMso "TabDeveloper" 'Thisis to open the built-in tab.
EndSub</code>
 
Upvote 0
Another similar code:

<code style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; font-family: Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace, sans-serif; vertical-align: baseline; box-sizing: inherit; white-space: inherit;">Sub SubOpenMyTab(ribbon As IRibbonUI) 'Starts during `Sheet` loading (event occurs after AutoOpen and everything else).
Set myRibbon = ribbon 'Remember the link to the Ribbon.
myRibbon
.ActivateTab ("Tab1") 'Write here the ID of the tab (which is written in XML).
' myRibbon.ActivateTab ("TabDeveloper") 'This is to open the built-in tab.
End Sub</code>
 
Upvote 0

Forum statistics

Threads
1,223,227
Messages
6,170,848
Members
452,361
Latest member
d3ad3y3

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top