none
Word 2010 - VBA macro to disable specific Groups RRS feed

  • Question

  • I've made both a Template and a Style Set.

    I need to try to get users accessing the custom Style Set and not screw up stuff (or get creative) using the groups: Font & Paragraph on the Home tab. I do understand that the users could probably still ctrl+[whatever] to achieve the same "custom" result, but most of my users are not "keyboard" people at all, they are "mouse + click" people. If they can't see it, they'll be more prone to "stick with the plan" and use the Styles dropdown instead.

    So I need help writing a macro that executes when Word 2010 is opened, that "grays out" or effectively disables (or hides) the groups Font and Paragraph from being used (or seen). I thought of adding a nice friendly msgbox that'll remind them to use Styles too.

    I tried recording: right click on ribbon, choose: customize ribbon, remove the Font and Paragraph tabs from Home (under the Main Tabs section). Yeah, Word 2010 didn't record a bloomin thing! So, I've been trying stuff and googling with basically zero luck.

    Wednesday, June 17, 2015 7:50 PM

Answers

  • Hi KindaConfused,

    According to the description, you want to disable the build-in groups using macro.

    As far as I know, we are not able to diable the build-in groups however we can hide them. And since from Office 2007, it use Ribbon instead of toolbars and menus. We can hide the Font and Paragraph group on the ribbon using XML like below:

    <customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui">
      <ribbon startFromScratch="false">
        <tabs>
          <tab idMso="TabHome">
            <group idMso="GroupFont"
                   visible="false"></group>
            <group idMso="GroupParagraph"
                   visible="false"></group>
          </tab>
        </tabs>
      </ribbon>
    </customUI>
    
    
    

    And we can use Custom UI Editor for the document-level customization and developing an VSTO add-in the application-level customization.

    You can get more detail about it from link below:
    Customizing the 2007 Office Fluent Ribbon for Developers (Part 1 of 3)

    Regards & Fei


    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, June 18, 2015 8:15 AM
    Moderator
  • Hi KindaConfused

    Fei has given you the basic idea of including a Ribbon customization in your template to hide the groups you don't want users to work with when editing a document based on your template.

    Even though you feel your users won't be familiar with keyboard shortcuts, how about right-click menus or the menus that display when the mouse hovers over a selection?

    If you really want to DISABLE the commands - and for the entire interface - an alternative option would be to use a <commands> section in the Ribbon XML with a <command> element for each command you don't want the user to be able to access - irregardless of the interface.


    Cindy Meister, VSTO/Word MVP, my blog

    Thursday, June 18, 2015 5:17 PM
    Moderator

All replies

  • Hi KindaConfused,

    According to the description, you want to disable the build-in groups using macro.

    As far as I know, we are not able to diable the build-in groups however we can hide them. And since from Office 2007, it use Ribbon instead of toolbars and menus. We can hide the Font and Paragraph group on the ribbon using XML like below:

    <customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui">
      <ribbon startFromScratch="false">
        <tabs>
          <tab idMso="TabHome">
            <group idMso="GroupFont"
                   visible="false"></group>
            <group idMso="GroupParagraph"
                   visible="false"></group>
          </tab>
        </tabs>
      </ribbon>
    </customUI>
    
    
    

    And we can use Custom UI Editor for the document-level customization and developing an VSTO add-in the application-level customization.

    You can get more detail about it from link below:
    Customizing the 2007 Office Fluent Ribbon for Developers (Part 1 of 3)

    Regards & Fei


    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, June 18, 2015 8:15 AM
    Moderator
  • Hi KindaConfused

    Fei has given you the basic idea of including a Ribbon customization in your template to hide the groups you don't want users to work with when editing a document based on your template.

    Even though you feel your users won't be familiar with keyboard shortcuts, how about right-click menus or the menus that display when the mouse hovers over a selection?

    If you really want to DISABLE the commands - and for the entire interface - an alternative option would be to use a <commands> section in the Ribbon XML with a <command> element for each command you don't want the user to be able to access - irregardless of the interface.


    Cindy Meister, VSTO/Word MVP, my blog

    Thursday, June 18, 2015 5:17 PM
    Moderator