Share via

Finding multiple characters in a Word document

Anonymous
2017-06-29T14:51:17+00:00

What code would I use in the Find dialogue box in Word to find all quotes (") and question marks (?) in a document and replace them with nothing (NULL)?

Thank you.

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

1 answer

Sort by: Most helpful
  1. Jay Freedman 207.7K Reputation points Volunteer Moderator
    2017-06-29T21:21:43+00:00

    If you're using the dialog box, first click the More button and check the box for "Use wildcards".

    In the Find What box, enter the expression

    [^34^0147^0148?]

    Leave the Replace With box empty, and click the Replace All button. (The three numeric codes are the ASCII values of the straight quote, opening curly quote, and closing curly quote, respectively.)

    If you're doing this with a macro, use code like this:

        Dim rg As Range

        Set rg = ActiveDocument.Range

        With rg.Find

            .Text = "[^34^0147^0148?]"

            .Replacement.Text = ""

            .MatchWildcards = True

            .Execute Replace:=wdReplaceAll

        End With

    Was this answer helpful?

    2 people found this answer helpful.
    0 comments No comments