Spot areas of tracked insertion-and-deletion

M

Mark Tangard

Hi gang,

Any ideas on how to write macro code to locate places in a document
where tracked deletions appear within, and superimposed upon, a larger
area of tracked insertions? (In case this description confuses, the
typical resulting view might be a full paragraph inserted (and therefore
underlined) but a phrase or sentence within that paragraph showing up in
BOTH underline and strikeout -- because one reviewer decided to remove
text from an earlier reviewer's insertion.)

I do realize the longer-term solution to this might involve shouting and
thumbscrews, but for now I'd like to figure out a classier method. Any
ideas? The logical route -- testing [range].Revisions(1).Type to see if
such a double-revision range has its own constant that's neither
wdRevisionInsert nor wdRevisionDelete doesn't seem to help. (I was
encouraged to see wdRevisionConflict in the list but that didn't lead
anywhere, and the relevant helpfile doesn't elaborate on the meaning of
any of the constants; it merely lists them without explanation.)

Any ideas? No suggestion too weird. TIA.
 
S

Shauna Kelly

Hi Mark

I'd try ActiveDocument.Revisions(1).Range.Start and .End and compare them
with ActiveDocument.Revisions(2).Range.Start and .End.

By the way, the Revisions(x).Type is, in my experience, entirely unreliable.
And it does not ever seem to match the description of the Revision shown in
the balloons, and that doesn' t match the description of the Revision in the
old pre-Word 2002 dialog box <*sigh*>. Somewhere here I have notes of
reproducible cases where those three offer three different descriptions of
one revision.

And, the Revisions collection is also unreliable. Don't do For Each... Next
on the .Revisions collection. Instead, do
For nCounter = 1 to ActiveDocument.Revisions.Count
... .Revisions(nCounter)
next nCounter

Hope your'e well.

Cheers

Shauna

Shauna Kelly. Microsoft MVP.
http://www.shaunakelly.com/word
 
M

Mark Tangard

Hi Shauna,

Yes, I gave up on the usual iterating early -- even a "For i = 1 etc" doesn't
work in this case, because when revisions overlap like this, Word *doesn't*
count them the way we see them. If you cycle through the revisions collection
and you encounter an "overlapping" tracked change (a deletion within an
insertion), Word counts them both as a *single* tracked revision!

BUT I did figure out a way. It catches most of them (It doesn't find any that
may be inside tables -- or rather, it finds them & then sorta has a heart
attack. And once in a while it finds a "false positive." The method is almost
comically low-tech:

- Go from one "revision" (Word's idea of a revision; may include the strange
double kind that we're hunting) to the next.

- Get the *length* of the revision.

- Accept changes for that range and get its NEW length.

- Now compare the 'before-accepting' and 'after-accepting' lengths. If
they're the same, accepting the change had no effect on the length, so do a
single UNDO and go to the next revision. If the 'after' length is 1 (or maybe
0, I've forgotten now), it indicates a deletion only, so again, just run UNDO
and go to the next revision. If the 'before' and 'after' lengths are different
but the 'after' length isn't zero, *that's* a combined insertion/deletion
tracking, so run UNDO and then flag the range (or whatever) and go the next
revision. It works.

The code is a god-awful mess right now so I won't post it yet, but that's the
logic of it.

Mark


Shauna said:
Hi Mark

I'd try ActiveDocument.Revisions(1).Range.Start and .End and compare them
with ActiveDocument.Revisions(2).Range.Start and .End.

By the way, the Revisions(x).Type is, in my experience, entirely unreliable.
And it does not ever seem to match the description of the Revision shown in
the balloons, and that doesn' t match the description of the Revision in the
old pre-Word 2002 dialog box <*sigh*>. Somewhere here I have notes of
reproducible cases where those three offer three different descriptions of
one revision.

And, the Revisions collection is also unreliable. Don't do For Each... Next
on the .Revisions collection. Instead, do
For nCounter = 1 to ActiveDocument.Revisions.Count
... .Revisions(nCounter)
next nCounter

Hope your'e well.

Cheers

Shauna

Shauna Kelly. Microsoft MVP.
http://www.shaunakelly.com/word


Hi gang,

Any ideas on how to write macro code to locate places in a document where
tracked deletions appear within, and superimposed upon, a larger area of
tracked insertions? (In case this description confuses, the typical
resulting view might be a full paragraph inserted (and therefore
underlined) but a phrase or sentence within that paragraph showing up in
BOTH underline and strikeout -- because one reviewer decided to remove
text from an earlier reviewer's insertion.)

I do realize the longer-term solution to this might involve shouting and
thumbscrews, but for now I'd like to figure out a classier method. Any
ideas? The logical route -- testing [range].Revisions(1).Type to see if
such a double-revision range has its own constant that's neither
wdRevisionInsert nor wdRevisionDelete doesn't seem to help. (I was
encouraged to see wdRevisionConflict in the list but that didn't lead
anywhere, and the relevant helpfile doesn't elaborate on the meaning of
any of the constants; it merely lists them without explanation.)

Any ideas? No suggestion too weird. TIA.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Track Changes Macro 1

Top