none
Word 2010: Defaulting "Bullets" button ( Paragraph group, "Home" tab ) to Custom Bulleted List RRS feed

  • Question

  • Using Word 2010,

    Either on Load or when the user clicks it, I am trying to make the "Bullets" button default to our company designed bulleted list.

    I have been looking high and low for a solution to capture the onClick event or reference the "Bullets" button, without success.

    Does anyone have code to reference the "Bullets" button either on Document Load or OnClick?


    Joel M

    • Edited by wheniconsider Wednesday, April 13, 2011 1:13 PM Version, Corrected Spelling
    Wednesday, April 13, 2011 1:11 PM

Answers

All replies

  • Use Styles


    Hope this helps.

    Doug Robbins - Word MVP,
    dkr[atsymbol]mvps[dot]org
    Posted via the Community Bridge

    "wheniconsider" wrote in message news:48067a88-302a-4e18-b6d7-5e4e356c828d@communitybridge.codeplex.com...

    Using Word 2010,

    Either on Load or when the user clicks it, I am trying to make the "Bullets" button default to our company designed bulleted list.

    I have been looking high and low for a solution to capture the onClick event or reference the "Bullets" button, without success.

    Does anyone have code to reference the "Bullets" button either on Document Load or OnClick?


    Joel M


    Doug Robbins - Word MVP dkr[atsymbol]mvps[dot]org
    Wednesday, April 13, 2011 7:55 PM
  • Hi Joel

    For many things, you can re-purpose the command in the Ribbon. This will not work, however, with a "gallery" type of control, which is what the Bullet button is. You're also not allowed to change the contents of a built-in group.

    That means you'd need to hide the built-in group, create your own group, with a button in that position instead of a gallery. But you won't get it to look exactly like the built-in group because MS doesn't give us the possibility to build two-row Ribbon groups, like its own. Custom groups lay out in three-rows...

    Here's a bit of sample XML code that does the first set of buttons and hides the built-in group, to give you a starting point:

    <customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui">
    <ribbon>
    	<tabs>
    	<tab idMso="TabHome">
    	<group idMso="GroupParagraph" visible="false" />
    	<group id="MyGroupParagraph" label="Paragraph" visible="true" insertBeforeMso="GroupParagraph" >
    		<box id="topRow" boxStyle="horizontal" >
    		<buttonGroup id="BulletsAndNumbering" >
    		<button id="MyBullet" onAction="MyBullet" imageMso="BulletsGalleryWord" />
    		<gallery idMso="NumberingGalleryWord" />
    		<gallery idMso="MultilevelListGallery" />
    		</buttonGroup>
    		
    		</box>
    	</group>
    	</tab>
    	</tabs>
    </ribbon>
    </customUI>
    
    

    The onAction code for the Bullet button follows and assumes there's a style of the name MyBullet:

    Sub MyBullet(control As IRibbonControl)
        Selection.Range.Style = "MyBullet"
    End Sub

     

     


    Cindy Meister, VSTO/Word MVP
    Thursday, April 14, 2011 1:40 PM
    Moderator
  • Hi Joel,

     

    Have you resolved your issue yet, and does the suggestion help you? If you have any concern on the thread, feel free to follow up.

     

    Best Regards,


    Bruce Song [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Tuesday, April 19, 2011 3:49 AM
  • Thanks Cindy.

    This post lead to the solution that I used: http://www.eggheadcafe.com/software/aspnet/36124529/how-to-link-bullet-icon-to-list-bullet-style.aspx

    Solution Quote:

    • "...intercept the built-in FormatBulletDefault command by placing this
      simple macro in your normal.dotm:

      Sub FormatBulletDefault()
      Selection.Paragraphs(1).Style = wdStyleListBullet
      End Sub"

     


    Joel M
    Wednesday, April 27, 2011 4:29 PM
  • Yes, this approach will work IF you're using VBA. From your original question I had the impression your code was "outside" the Word application.
    Cindy Meister, VSTO/Word MVP
    Wednesday, April 27, 2011 4:33 PM
    Moderator