Advertisement

02.20.2008 at 06:33AM PST, ID: 23177624
[x]
Attachment Details

Can MS Word find a range with a 'tracked change' in the middle of it?

Asked by PatternNut in Visual Basic Programming, Microsoft Word

Tags: VBA / VB6

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
[+][-]02.20.2008 at 07:20AM PST, ID: 20938580

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Visual Basic Programming, Microsoft Word
Tags: VBA / VB6
Sign Up Now!
Solution Provided By: jpeca
Participating Experts: 1
Solution Grade: A
 
 
[+][-]02.20.2008 at 08:39AM PST, ID: 20939429

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628