none
How to create Custom Toolbar in Word 2010 and display it under Add-Ins (This will be document specific and not saved in normal.dotm) RRS feed

  • Question

  • Hello,

    I have created .dotm file in word 2010. In that file I have several macros as shown in below screenshot.

    I need to create a custom toolbar which will be shown under Add-Ins tab (As shown below).

    Custom toolbar has Button, Dropdown and Image Button.

    Can you please tell me how to achieve this?

    Important: This custom tool-bar should work only for this document and it should not be shown in other documents. Also If I copy the document to other machine, It should work same as it works on development machine.

    Thanks!
    Kalpen


    Friday, March 1, 2013 6:47 AM

Answers

  • If you still have access to Office 2003, see the following page of fellow MVP Graham Mayor's website:

    http://www.gmayor.com/Toolbars_in_word_2007.htm

    However, you probably should bit the bullet and learn how to customize the ribbon.  For that, see the following page of Greg Maxey's website:

    http://gregmaxey.mvps.org/word_tip_pages/customize_ribbon_main.html


    Doug Robbins - Word MVP dkr[atsymbol]mvps[dot]org

    Friday, March 1, 2013 9:12 AM
  • Hi Kalpen,

    To custom ribbon for a specific document, I provided the following steps to give you a quick start:

    1. New a docm file named as “TestRibbon.doxm”.

    2. Open the docm file in the “Custom UI Editor For Microsoft Office", insert a "Office 2010 Custom UI part" from the Insert menu.

    3. Paste the following XML:

    <customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui">
    	<ribbon startFromScratch="false">
    		<tabs>
    			<tab idMso="TabAddIns">
    				<group id="customGroup" label="Custom Group">
    					<button id="customButton" label="Custom Button" imageMso="HappyFace" size="large" onAction="Callback" />
                                  <dropDown id="customDDItems"  
     onAction="CallbackOnActionForDD"  label="Items">
        <item id="Item1" label="Item1"/>
        <item id="Item2" label="Item2"/>
        <item id="Item3" label="Item3"/>    
        </dropDown>
    				</group>
    			</tab>
    		</tabs>
    	</ribbon>
    </customUI>

    Here idMso is for a built-in control, and id is for a custom control. 

    Save and close the "Custom UI Editor For Microsoft Office".

    4. Open the "TestRibbon.docm" in Word, open the VBE via Alt+F11. Copy the following code into a standard module:

    Sub Callback(control As IRibbonControl)
    MsgBox "Happy!"
    End Sub
    
    
    'Callback for customDDItems onAction
    Sub CallbackOnActionForDD(control As IRibbonControl, id As String, index As Integer)
    Select Case id
    Case "Item1": MsgBox "You selected Item1"
    Case "Item2": MsgBox "You selected Item2"
    Case "Item3": MsgBox "You selected Item3"
    End Select
    
    End Sub

    For more info about the DropDown control,  refer to:

    Customize the Word 2007 Ribbon User Interface (UI)

    To download the CustomUI Editor, please try:

    Custom UI Editor Tool

    Good day.


    Yoyo Jiang[MSFT]
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    This response contains a reference to a third party World Wide Web site. Microsoft is providing this information as a convenience to you. Microsoft does not control these sites and has not tested any software or information found on these sites; therefore, Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there. There are inherent dangers in the use of any software found on the Internet, and Microsoft cautions you to make sure that you completely understand the risk before retrieving any software from the Internet.

    Monday, March 4, 2013 11:11 AM
    Moderator

All replies

  • If you still have access to Office 2003, see the following page of fellow MVP Graham Mayor's website:

    http://www.gmayor.com/Toolbars_in_word_2007.htm

    However, you probably should bit the bullet and learn how to customize the ribbon.  For that, see the following page of Greg Maxey's website:

    http://gregmaxey.mvps.org/word_tip_pages/customize_ribbon_main.html


    Doug Robbins - Word MVP dkr[atsymbol]mvps[dot]org

    Friday, March 1, 2013 9:12 AM
  • Hi Kalpen,

    To custom ribbon for a specific document, I provided the following steps to give you a quick start:

    1. New a docm file named as “TestRibbon.doxm”.

    2. Open the docm file in the “Custom UI Editor For Microsoft Office", insert a "Office 2010 Custom UI part" from the Insert menu.

    3. Paste the following XML:

    <customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui">
    	<ribbon startFromScratch="false">
    		<tabs>
    			<tab idMso="TabAddIns">
    				<group id="customGroup" label="Custom Group">
    					<button id="customButton" label="Custom Button" imageMso="HappyFace" size="large" onAction="Callback" />
                                  <dropDown id="customDDItems"  
     onAction="CallbackOnActionForDD"  label="Items">
        <item id="Item1" label="Item1"/>
        <item id="Item2" label="Item2"/>
        <item id="Item3" label="Item3"/>    
        </dropDown>
    				</group>
    			</tab>
    		</tabs>
    	</ribbon>
    </customUI>

    Here idMso is for a built-in control, and id is for a custom control. 

    Save and close the "Custom UI Editor For Microsoft Office".

    4. Open the "TestRibbon.docm" in Word, open the VBE via Alt+F11. Copy the following code into a standard module:

    Sub Callback(control As IRibbonControl)
    MsgBox "Happy!"
    End Sub
    
    
    'Callback for customDDItems onAction
    Sub CallbackOnActionForDD(control As IRibbonControl, id As String, index As Integer)
    Select Case id
    Case "Item1": MsgBox "You selected Item1"
    Case "Item2": MsgBox "You selected Item2"
    Case "Item3": MsgBox "You selected Item3"
    End Select
    
    End Sub

    For more info about the DropDown control,  refer to:

    Customize the Word 2007 Ribbon User Interface (UI)

    To download the CustomUI Editor, please try:

    Custom UI Editor Tool

    Good day.


    Yoyo Jiang[MSFT]
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    This response contains a reference to a third party World Wide Web site. Microsoft is providing this information as a convenience to you. Microsoft does not control these sites and has not tested any software or information found on these sites; therefore, Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there. There are inherent dangers in the use of any software found on the Internet, and Microsoft cautions you to make sure that you completely understand the risk before retrieving any software from the Internet.

    Monday, March 4, 2013 11:11 AM
    Moderator
  • Monday, March 4, 2013 8:07 PM