VBA code to apply format Clear All style to selection

Anonymous
2017-07-04T18:18:35+00:00

Hi, I use Dragon Naturally Speaking commands to call VBA subroutines to apply various paragraph and character styles in Word. I have 20 working macros of this form:

Sub FormatRed()

    Selection.Style = ActiveDocument.Styles("Intense Emphasis")

End Sub

I would like to make a subroutine that uses "Clear All" instead of Intense Emphasis, but Word seems to protest that there is no such style. In other words, the "Clear All" operation is not represented as a style in the known style list. It's only available as some kind of a direct call to some subroutine somewhere.

Is there any way I can use a VBA call to clear formatting as if I manually clicked Clear All at the top of the Styles pane?

I've looked on the net, looked through the Intellisense on ActiveDocument.*, and searched the forums, but have found nothing.

The reason I want a voice-driven Clear All command is that setting the format to Normal does not always undo tricky formatting under the hood. Normal "kind of" applies normal, but in some cases, it cannot undo what is already there.

Thank you. Here's hoping you know something that I can't find.. :-)

***Post moved by moderator to appropriate forum category.***

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
{count} votes
Answer accepted by question author
  1. HansV 462.4K Reputation points MVP Volunteer Moderator
    2017-07-04T19:36:55+00:00

    You can use

        Selection.ClearFormatting

    2 people found this answer helpful.
    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Anonymous
    2017-07-04T20:36:03+00:00

    It works!!

    Thank you!

    0 comments No comments