none
Adding controls from a VSTO ribbon tab into a custom ribbon tab RRS feed

  • Question

  • Please forgive me if this is a stupid question, which it might very well be, since I'm a noob in this area.

    I'm managing a template system that consists of two parts: A VSTO COMaddin (which I can't modify) and a docm-file that includes all the macros. I would like to store these controls under the same ribbon tab.

    I figured I could do this by creating a customUI.xml by doing something like this: 

    <customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui" xmlns:x1="My.AddIn" onLoad="OnLoadVS">
    	<ribbon startFromScratch="false">
    		<tabs>
    			<tab id="MyNewTab">
    				<group id="Test" label="Test">
    					<button idQ="x1:MyAddInButton" visible="true"/>
    				</group>	
    			</tab>
    			<tab idQ="x1:MyAddInTab" visible="false"/>
    		</tabs>
    	</ribbon>
    </customUI>

    But of course it's much more complicated than that. So I thought it might be better to ask if this is even possible. What I want to do is basically:

    1. Create a new tab with all the controls from the two existing tabs

    2. Hide the existing tabs

     
    • Edited by JohanMH Wednesday, September 23, 2015 3:48 PM
    Wednesday, September 23, 2015 3:48 PM

Answers

  • Hi JohanMH,

    Please try to use the same idQ value with the same namespace and check the result.

    <tab idQ="[the tab idQ that you want to add your control]">
    				<group id="Test" label="Test">
    					<button idQ="x1:MyAddInButton" visible="true"/>
    				</group>	
    			</tab>

    Regards

    Starain


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    Thursday, September 24, 2015 7:28 AM
    Moderator
  • Hi JohanMH,

    Base on my test in word 2013, with the same idQ value and same namespace could achieve that.

    For example:

    <?xml version="1.0" encoding="UTF-8"?>
    <customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui" xmlns:x="starain.com" onLoad="Ribbon_Load">
      <ribbon>
        <tabs>
          <tab idQ="x:MyCustomTab" label="Jerome" insertAfterMso="TabView">
            <group id="MyGroup"
                   label="My Group">
              <button id="btn3" label="button2" onAction="ShowTest2"/>
            </group>
          </tab>
        </tabs>
      </ribbon>
    </customUI>

    <?xml version="1.0" encoding="UTF-8"?>
    <customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui" xmlns:x="starain.com" onLoad="Ribbon_Load">
      <ribbon>
        <tabs>
          <tab idQ="x:MyCustomTab" label="Jerome" insertAfterMso="TabView">
            <group id="MyGroup2"
                   label="My Group2">
              <button id="btn2" label="ggg" onAction="ShowTest"/>
            </group>
          </tab>
         
        </tabs>
      </ribbon>
    </customUI>
    

    Regards

    Starain


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Monday, September 28, 2015 5:28 AM
    Moderator

All replies

  • Hi JohanMH,

    Please try to use the same idQ value with the same namespace and check the result.

    <tab idQ="[the tab idQ that you want to add your control]">
    				<group id="Test" label="Test">
    					<button idQ="x1:MyAddInButton" visible="true"/>
    				</group>	
    			</tab>

    Regards

    Starain


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    Thursday, September 24, 2015 7:28 AM
    Moderator
  • Does Word guarantee any sort of load order? I would guess not. If the first addin doesn't load first, you can't use it. This approach may be unworkable.

    Though, here's a Word 2010 question about this that seems to imply there's a way to specify load order, but does not give technical details. Apparently it loads alphabetically, unless you create a 'master addin', but this sounds pretty awkward and complex.

    Friday, September 25, 2015 4:49 PM
  • Hi JohanMH,

    Base on my test in word 2013, with the same idQ value and same namespace could achieve that.

    For example:

    <?xml version="1.0" encoding="UTF-8"?>
    <customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui" xmlns:x="starain.com" onLoad="Ribbon_Load">
      <ribbon>
        <tabs>
          <tab idQ="x:MyCustomTab" label="Jerome" insertAfterMso="TabView">
            <group id="MyGroup"
                   label="My Group">
              <button id="btn3" label="button2" onAction="ShowTest2"/>
            </group>
          </tab>
        </tabs>
      </ribbon>
    </customUI>

    <?xml version="1.0" encoding="UTF-8"?>
    <customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui" xmlns:x="starain.com" onLoad="Ribbon_Load">
      <ribbon>
        <tabs>
          <tab idQ="x:MyCustomTab" label="Jerome" insertAfterMso="TabView">
            <group id="MyGroup2"
                   label="My Group2">
              <button id="btn2" label="ggg" onAction="ShowTest"/>
            </group>
          </tab>
         
        </tabs>
      </ribbon>
    </customUI>
    

    Regards

    Starain


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Monday, September 28, 2015 5:28 AM
    Moderator
  • Thank you Starain, I finally got it to work!

    I was under the impression that I couldn't add buttons to a VSTO-created Group this way, but luckily I was wrong. Thanks again!

    Monday, September 28, 2015 7:13 AM