View Single Post
 
Old 08-12-2024, 06:49 AM
Italophile Italophile is offline Windows 11 Office 2021
Expert
 
Join Date: Mar 2022
Posts: 554
Italophile is just really niceItalophile is just really niceItalophile is just really niceItalophile is just really nice
Default

You can also add ribbon code to the styles manager that will add the button to the tab created by the ribbon manager template. You will need to modify the ribbon xml to make this work.

For your ribbon manager:

Code:
<?xml version="1.0" encoding="UTF-8"?>
<customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui"
          xmlns:nsHost="rbnManager">
  <ribbon startFromScratch="false">
    <tabs>
      <tab idQ="nsHost:Company" label="Company">
        <group idQ="nsHost:newGroup" label="New">
          <menu id="mnuMemo" 
                size="large" 
                label="Memo" 
                imageMso="NewPageOneNote">
            <button id="btnCreateMemo" 
                    label="New memo" 
                    onAction="mMemo.CreateNewMemo"/>
            <button id="btnEditMemo" 
                    label="Edit memo" 
                    onAction="mMemo.EditMemo"/>
          </menu>
        </group>
      </tab>
    </tabs>
  </ribbon>
</customUI>
For your style manager:

Code:
<?xml version="1.0" encoding="UTF-8"?>
<customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui"
          xmlns:nsClient="rbnManager">
    <tabs>
      <tab idQ="nsClient:Company">
        <group idQ="nsClient:newGroup">
          <button id="btnStyleManager" 
                  label="Paragraph Styles" 
                  onAction="ShowfrmParagraphStylesIfNecessary"/>
        </group>
      </tab>
    </tabs>
  </ribbon>
</customUI>
NOTE: I have used this method to add items to a custom ribbon that are specific to a particular document template, but I would hesitate to use this for two templates that are in the startup folder as it is not possible to control the order in which they are loaded.
Reply With Quote