qjgods
qjgods

Reputation: 1000

How to find and replace mixing format text in MS-Word or using VBA

Here is an example of what I want. Suppose a text:

paper[1], some texts[2], paper[3]

Here is the expected result ==>

paper[1], some texts[2], paper[3]

That is, I want to replace all "paper[1]" with "paper[1]" and similarly, replace "paper[3]" with "paper[3]" but keep the texts[2] unchanged.

I have noticed that word can not search the mixing format text, e.g., I can not find the text "paper[3]". So I may need the VBA to achieve this. Any ideas? Thanks!

Upvotes: 0

Views: 93

Answers (1)

macropod
macropod

Reputation: 13515

You don't even need VBA for that! A wildcard Find/Replace can be used, where:

Find = paper\[[13]\]
Replace = ^&

and the replacement font is set to 'not superscript'. If you really want a macro, record the above.

Upvotes: 1

Related Questions