M
Mark Tangard
I’m trying to add code to a macro to make it behave differently if the text it
works on has tracked changes, but Word seems to act on whim rather than reality.
Has anyone else tried to use [range_object].Revision(1).Type and gotten
inconsistent or apparently wrong results?
For example, in some documents I want the macro to add characters to a certain
word, but only if the word isn't within a tracked deletions, since that makes
the added characters UN-tracked (undeleted), so when revisions are accepted the
added characters remain while what’s around it is erased. I would have thought
code like this:
If Selection.Range.Revisions(1).Type = wdRevisionDelete Then [etc]
.....where the Selection is only 1 word and definitely contains only 1 revision,
would allow the code to evaluate accordingly and consistently (and in this case,
skip the action that would be performed if the Selection had no tracking).
But very often it behaves as if this line of code isn’t there, and the action
after that line *is* performed, with unmanageable results.
Testing with MsgBox Selection.Range.Revisions(1).Type seems to return equally
baffling results -- often it returns the value of 1 for an insertion *or* a
deletions.
Am I using the wrong constant? I don’t see one that would mean the same thing.
Any help appreciated.
works on has tracked changes, but Word seems to act on whim rather than reality.
Has anyone else tried to use [range_object].Revision(1).Type and gotten
inconsistent or apparently wrong results?
For example, in some documents I want the macro to add characters to a certain
word, but only if the word isn't within a tracked deletions, since that makes
the added characters UN-tracked (undeleted), so when revisions are accepted the
added characters remain while what’s around it is erased. I would have thought
code like this:
If Selection.Range.Revisions(1).Type = wdRevisionDelete Then [etc]
.....where the Selection is only 1 word and definitely contains only 1 revision,
would allow the code to evaluate accordingly and consistently (and in this case,
skip the action that would be performed if the Selection had no tracking).
But very often it behaves as if this line of code isn’t there, and the action
after that line *is* performed, with unmanageable results.
Testing with MsgBox Selection.Range.Revisions(1).Type seems to return equally
baffling results -- often it returns the value of 1 for an insertion *or* a
deletions.
Am I using the wrong constant? I don’t see one that would mean the same thing.
Any help appreciated.