1
votes

I have a VBA Word Macro that gets words from .txt list and color highlight them in a word .doc document.

The problem is that the script ignores whitespaces and wildcards from the .txt list. I insert the word "wit" but it also changes words like witHIN , witCHE, etc.

I tried inserting wildcards in the .txt file, like or using white spaces like " wit ", but it didnt worked. The script ignore the whitespaces and the wildcards.

THE CODE IS HERE: http://pastebin.com/m3e20f932

Melissa.

2
Thanks for linking to the code, BTW.cori

2 Answers

1
votes

Maybe you need to add the option .matchWholeWord = True to line 233? If you would rather do it by using whitespace, you could remove the Trim on line 63. If you want to use wildcards, you would need to have .MatchWildcards = True on line 233.

0
votes

You might try adding the MatchWholeWord:=True property to your Execute statement.

It's untested, but I believe that will give you the results you want.