简体   繁体   中英

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, eg, I can not find the text "paper [3] ". So I may need the VBA to achieve this. Any ideas? Thanks!

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM