开发者

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


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,

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜