Hi Experts,
I'm building a Word add-in using VBA / VB6 and tracked changes are playing havoc on the search function.
I want to search for the word 'context variable'. This word is in the document as exactly that. If I open the 'find' dialog and type in 'context variable', it finds it.
However, this code will not find it:
set rng = activedocument.range
If rng.Find.Execute("context variable") Then
'run code
else
'return error
end if
The reason why it doesn't find it is that there used to be a hyphen in between the two words. Tracked changes mode is on and the hyphen that has become a space, still exists in the tracked changes. As a result, it never finds "context variable" even though it is there. If I accept all changes in the document, it works fine... but that is NOT an option.
Any ideas? Any possible work-around? Anything at all? This really has me beat.
Thanks in advance for any thoughts,
Patternnut
Start Free Trial