Find & Replace - Multiple Word 2007 documents

Hi Galaxiom,
Thanks for the post it was really useful. I just have a quick question. I need to find words like abcB1 and replace it with abcB2. The above macro changes all B1 to B2. That's good I have words like that but in addition I need to change for the words abcB1, abB1c, abB1, .cB1. too. If its a part of one word how to get it done? Any insights would be great. Thanks in advance.
 
Last edited:
If its a part of one word how to get it done? Any insights would be great.

I have not quite been able to understand how you need to vary the outcome.

However, take a look at the parameters of the Find Object. My sub just uses the defaults (the blanks between the commas) for most of them. Maybe you will be able to work out what you need to change?

Alternatively, break out the Find section of the sub into a separate sub and implement some arguments for the find and replace strings. Then you can loop through multiple replacements to cover all the required variations.
 
Hey Galaxiom, thanks for the code it is very useful, I also registered to reply !
I am facing two issues.

What if I want to change just a part of a word? For instance if I want to turn intention to intent°

I trid to define :

Const Find1 = "tion"
Const Replace1 = "t°"

But if it is inside a word it would not change it.

Also, how can I insert a symbol. I want an upper arrow and I tried to define it with unicode but the way the value is defined (as a const) it doesn't accept it.

Const Find2 = "increasing"
Const Replace2 = ChrW(&H2191)

If you could tell me how can I change a word into a symbol and how can I replace letters within a word it would be amazing !

Regards

Santi
 
Hey Galaxiom,

Thanks for your code. It really helped in solving my problem of finding and replacing multiple strings in Word.

However, I have an additional requirement and I am not able to find a solution for it. I want to switch on the Track change mode in the Macro before replacing the text. If this is not possible then I would like to highlight the replaced text in some color.

This is because I want to verify the text that was replaced in the documents.

Thank you in advance!
 
Open the attached document and agree to the macros running.

Instructions are in the document.

It not an especially elegant rendition of the task as it requires you to edit the macro rather than have a nice list of replacements but it will do you your job.

I will check how you went in the morning.

Dear Galaxiom,
I am using Ms word 2013 and 365. I wanted to replace a list of words with some other words like A with B, and C with D.
When I searched on internet I found this forum. I have downloaded ReplaceMulti.zip and It works good. But I want to replace some non unicode words with unicode Sinhalese words. eg. "wruqK" should be replaced with "අරමුණු". Unfortunately Microsoft Visual Basic for Applications seems to be not supporting Unicode, So it displays like "??????".
Is possible for you provide a solution for this?
OR
Is there any other way to replace?
 
Hi Galaxiom,

Thanks a lot for your code. I am having the same problem that the original user has in that I have added my own search and replace terms and run the macro with seeming success, however when I open the document, no changes have been made. I would be grateful for any advice you could give on this. Here are the terms I have entered:

Const Find1 = " cilantro "
Const Replace1 = " coriander "

Const Find2 = " arugula "
Const Replace2 = " rocket "

Const Find3 = " color "
Const Replace3 = " colour "

Const Find4 = " zucchini "
Const Replace4 = " courgette "

Const Find5 = " Yogurt "
Const Replace5 = " Yoghurt "

Const Find6 = " veggie "
Const Replace6 = " veg "

Thanks and best,

David
 
Hi David, I noticed there hasn't been a reply yet so figured I'd jump in and give it a shot.

Do you mind posting the exact and entire code you are using? I know it's basically the same as G's with Const edits, but do you mind posting it in its entirety?
 
I am getting a "User-defined type not defined" error when trying to run the Galaxiom's macro on Mac?
 
Is it a Compile error or a Runtime error?
Are you running the code from within Word or another Office program?
 

Users who are viewing this thread

Back
Top Bottom