Denis
Denis

Reputation: 12077

On an Excel ribbon, how can I align my button all the way to the right?

How can I make the "Settings" button (from the XML below) appear all the way on the right on the excel ribbon? Here is the XML for my ribbon:

<customUI xmlns='http://schemas.microsoft.com/office/2006/01/customui' onLoad='ribbonLoaded'>
      <ribbon>
        <tabs>
          <tab id='tbApp' label='MyApp'>
            <group id='grpInfo' label='Info'>
              <splitButton id='split' size='large'>
                    <button id='wizardButton' label='Wizard' getImage='GetImage'  onAction='OnButtonPressed'/>
                    <menu id='wizardMenu' >
                      <button id='BTNC'  label='BTNC' onAction='OnBTNCPressed'/>
                      <button id='BTNB'  label='BTNB' onAction='OnBTNBPressed' />
                      <button id='BTNA'  label='BTNA' onAction='OnBTNAPressed' />
                    </menu>
              </splitButton>
            </group >
            <group id='settingsGroup' label=' '>
                <button id='settingsButton' label='Settings' getImage='GetImage'  onAction='OnSettingsPressed'/>
            </group >
          </tab>
        </tabs>
      </ribbon>
    </customUI>";

Upvotes: 2

Views: 986

Answers (1)

Cindy Meister
Cindy Meister

Reputation: 25663

Ribbon XML doesn't provide for this.

Closest you can get are the

  • insertAfterMso
  • insertAfterQ
  • insertBeforeMso
  • insertBeforeQ

attributes that allow you to position a tab (or a group) relative to other tabs (or groups). These are only applicable for built-in controls (idMso) and custom controls for which you have the idQ value.

Even if you were to set insertAfterMso to the last built-in tab there's no guarantee your tab would be the last if other Ribbon customizations are also loading. They'll be loaded in a indeterminate order (meaning no one can set in which order things are loaded) and "last one wins".

If you had two add-ins, one set to load automatically and the other configured to only load on-demand, your chances would be better. The one that loads automatically could be responsible for loading the add-in with your Ribbon. As long as no one else tries the same thing, chances are your tab will be the last one...

Upvotes: 2

Related Questions