Find & Replace - Multiple Word 2007 documents (1 Viewer)

rakini22

New member
Local time
Yesterday, 23:15
Joined
Jul 18, 2017
Messages
1
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:

Galaxiom

Super Moderator
Staff member
Local time
Today, 14:15
Joined
Jan 20, 2009
Messages
12,065
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.
 

Santi

New member
Local time
Yesterday, 21:15
Joined
Aug 16, 2017
Messages
1
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
 

puneetmehta90

New member
Local time
Today, 06:15
Joined
Oct 26, 2017
Messages
1
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!
 

anashussain

New member
Local time
Yesterday, 21:15
Joined
Sep 22, 2018
Messages
1
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?
 

phobic

New member
Local time
Today, 05:15
Joined
Sep 1, 2020
Messages
1
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
 

Isaac

Lifelong Learner
Local time
Yesterday, 21:15
Joined
Mar 14, 2017
Messages
2,022
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?
 

wordguy

New member
Local time
Today, 00:15
Joined
Sep 18, 2020
Messages
1
I am getting a "User-defined type not defined" error when trying to run the Galaxiom's macro on Mac?
 

Isaac

Lifelong Learner
Local time
Yesterday, 21:15
Joined
Mar 14, 2017
Messages
2,022
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 (Users: 0, Guests: 1)

Top Bottom