Share via

Microsoft Word VBA: disabling new or modify styles

Anonymous
2023-06-28T10:52:27+00:00

Hello

Does anyone know the code for how to disable the New Style or Modify Styles commands?

I am regularly asked by corporate clients on how to stop colleagues messing up the formatting. Restrict Editing imposes too many restrictions for most of their needs. I am able to switch off the Font dropdown menu, I can make changes the tabs.

But one thing I've found doesn't work is changing the Styles Pane or options. I've tried removing the keyboard shortcut, I've tried changing the XML file and changing the various styles commands to False, I've tried writing what I know in VBA... none of it has worked!

Ideally, I'd like people to still use the Styles Pane as they are, but I just want the Modify and New Styles to be turned off. Is this possible?

Microsoft 365 and Office | Word | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

8 answers

Sort by: Most helpful
  1. Charles Kenyon 167.4K Reputation points Volunteer Moderator
    2023-06-28T23:01:30+00:00

    Be sure to tell your clients that if they really want to be able to do this they need to use the feedback mechanisms linked previously to get that word to Microsoft.

    Probably a more obtainable method is to implement good training and expect people to follow rules. :)

    Was this answer helpful?

    3 people found this answer helpful.
    0 comments No comments
  2. Charles Kenyon 167.4K Reputation points Volunteer Moderator
    2023-06-28T11:35:45+00:00

    Hi Natalie,

    Have you tried restricting editing to specified styles and limiting these in the Manage Styles dialog? It sounds as if you have but the restrictions set in the Manage Styles dialog are quite firm and should address your issues.

    Managing Word Styles by Suzanne Barnhill, MVP

    If you set permitted styles, modification of the permitted styles is not an option in the User Interface. You cannot set tabs in the ruler. You cannot change the font using the drop-down.

    Here is a temporary link to a sample document so restricted. You are welcome to see if you can modify any of the styles.

    https://www.dropbox.com/s/48absdpol9vdrux/deleteme%20restricted%20styles%202023-06-28.docx?dl=0

    Was this answer helpful?

    2 people found this answer helpful.
    0 comments No comments
  3. Charles Kenyon 167.4K Reputation points Volunteer Moderator
    2023-06-28T17:17:22+00:00

    Hello Charles

    Thank you for replying! The problem that some of my clients have is that it doesn't just restrict the Home tab. It also means the Breaks button in the Layout tab is disabled; it also switches off several commands in the Table Design and Layout tabs. For some financial sector clients, that's a big no-no.

    That's why I wanted to change the XML file and amend the tabs and commands instead. Some clients want certain commands like Bold, Italic and Underline to work, so Restrict Editing is out-of-the-question. Changing the XML is perfect in that I can switch off the Font dropdown menu and keep the buttons they do want; I just need to switch off the Modify Style and New Style dialog boxes, but I can't find a way - and I've been looking for years now!

    I know of no XML or vba method to do what your clients want. That may be speaking to my ignorance rather than what can be done.

    Using XML Ribbon modification, you can certainly remove the font drop-down, but not the right-click menu unless you also modify that, which can be done. Customize Text Shortcut Menu by Greg Maxey

    The restrict styles, though, can still allow use of bold, italics, and underlining through character styles. The sample I prepared has styles for both Bold and Italics (Strong and Emphasis) as well as combinations. They are used in the sample. The same could be done for numbering (attach to permitted styles).

    Other than styles restriction, I know of nothing to cure this minitoolbar:

    Image

    With styles restricted, you get most formatting commands including the font dropdown disabled as shown:

    Image

    Apparently the restriction of styles gives the Reviewing commands on this minitoolbar even though Track Changes has never been implemented and there are no comments.

    There is no vba or XML available to change this toolbar.

    With Styles Restriction applied, this is the Styles Pane in the Sample Document. This is with the options set to display all styles in alphabetical order. All of the styles shown in the Styles Pane specifically had to be permitted except Clear All, Default Paragraph Font, and Normal.

    Image

    Only those that are in the [Quick] Access Toolbar show up using the Styles button in the minitoolbar.

    You are correct that substantial portions of the Table Design and Layout Tabs are disabled.

    Image

    The Table Design issue might be addressed using Quick Tables. The things disabled in the Layout Tab could be addressed with a Custom Ribbon and vba commands that would emulate the commands otherwise available. Certainly the Breaks issue could be addressed with vba. I expect Columns could as well. Customize the Office Ribbon (It doesn't take rocket science) by Greg Maxey

    I think style restriction through Manage Styles is as close to what your clients want as you can get in Word.

    You can ask Microsoft for even more control, but do not expect a response other than a possible product change.

    Giving Feedback on Microsoft Word or other Microsoft Products

    Was this answer helpful?

    1 person found this answer helpful.
    0 comments No comments
  4. Anonymous
    2023-06-28T16:13:54+00:00

    Hello Charles

    Thank you for replying! The problem that some of my clients have is that it doesn't just restrict the Home tab. It also means the Breaks button in the Layout tab is disabled; it also switches off several commands in the Table Design and Layout tabs. For some financial sector clients, that's a big no-no.

    That's why I wanted to change the XML file and amend the tabs and commands instead. Some clients want certain commands like Bold, Italic and Underline to work, so Restrict Editing is out-of-the-question. Changing the XML is perfect in that I can switch off the Font dropdown menu and keep the buttons they do want; I just need to switch off the Modify Style and New Style dialog boxes, but I can't find a way - and I've been looking for years now!

    Was this answer helpful?

    0 comments No comments
  5. Deleted

    This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.


    Comments have been turned off. Learn more