Robert
Robert

Reputation: 1

VBA Word and using Excel columns as a lookup and replace

I have a MS Word Doc that has the wrong words in it when it comes to me. I have a list of these words in Excel column A of book1, sheet1. I also have what the words should be column B of book1, sheet1.

The list is about 300 words but the doc is only 50 words.

My thought is to copy and paste the text in the word doc with the VBA. Run a VBA to set Col A as a string and search the word doc. When found, replace it with Col B. At the end of the Doc set the next Col A as the string and do it again... until last line.

I've work in Excel coding but I lost on this one. As always any help is great.

Robert

Upvotes: 0

Views: 592

Answers (1)

JMax
JMax

Reputation: 26601

You can use the vba dictionary object to build a dict with your Excel values.

Then, you can parse every value of your dictionary and Search & Replace the value in your Word document. Need to test because it could be slow though.

Regards,

Upvotes: 0

Related Questions