Possible Revisions Bug found in Word 2000, XP, and 2003

T

Tom Grant

Hello everyone,

I think I have found a bug that I have not seen posted. I have seen this
problem in Word 2000, XP, and 2003, which leads me to believe that either I
am doing something wrong, the bug has not been reported, or no one really
cares for a fix.

The Possible Bug:
This is how I produce the problem.

1) I open a new document.
2) Insert a 2x2 table.
3) Turn on track changes.
4) I type "Insert 1" into cell 1.
5) I type "Insert 2" into cell 4.
6) I select the two rows by dragging cursor from cell 1 to cell 4.
7) I change the font size from 12 to 8 pt.
8) In the immediate window in vba, I typed the follow:
debug.Print ActiveDocument.Range.Revisions.Count
9) Hit enter
10)In the immediate window in vba, I typed the following:
debug.Print ActiveDocument.Range.Revisions(1).Type
11) Hit enter
12) I repeated 10 and 11 for each Revision up to 4.

I get a result of 4 in step 8. I am guessing that it is the two
inserts and then a format change for each row. Is this a correct
assumption?

If so, then I would expect two of the revisions to have revision
type 1 (Insert) and the other two to have revision type 3 (Format change).
However, I got three of the revisions with revision type 1 and
only one revision had type 3.

The revision that I would expect to be a 3 has an index of 2. When
I type the following in the immediate window the entire first row is
selected.

ActiveDocument.Range.Revisions(2).Range.Select



Can anyone else confirm this bug? Or even better show me the error
of my ways.

Thanks

Tom
 
K

Klaus Linke

Hi Tom,

Just wanted to let you know that there *are* bugs (plural) with revisions in
tables, and VBA access to them.

Also, your analysis looks 100% on target.

In the higher versions, some things go wrong differently, but they still go
wrong.

In Word2000, I get only two revisions following your steps, and Word answers
questions about the second revision with a run-time error 5852 (Object not
available).

In Word2002/2003 I can reproduce your results.

The obvious bug is that the second revision (with a range spanning the first
row) should be of type 3 (wdRevisionProperty), not 1 (wdRevisionInsert).

If you play around a bit more, you'll find more and more bugs.
With deletions, the total number of revisions often goes down, and trying to
access some of the revisions then causes run-time error 5852 (Object not
available). Another thread I remember (there have been more):
http://www.google.com/[email protected]

The macro below may help you dissect the bugs...
I only put in code for insertions, deletions, and formatting changes.

But I don't know how to find the "real" type of the revisions, or a reliable
way to get the info from revisions in tables.

I tried to report bugs on these issues to MS, and surely others have done
the same.
Seems to be one of the things that are way down on MS's list of priorities.

Regards,
Klaus



Sub ShowMyRevisions()
Dim rv As Revision
Dim strMsg As String
Selection.HomeKey (wdStory)
Do
Set rv = Selection.NextRevision(True)
strMsg = "Revision: " & rv.Index & vbCr
strMsg = strMsg & "Range: " & _
rv.Range.Start & _
", " & rv.Range.End & vbCr
strMsg = strMsg & "Type " & rv.Type & ": "
Select Case rv.Type
Case wdRevisionInsert
strMsg = strMsg & "Insert" & vbCr & _
rv.Range.Text
Case wdRevisionDelete
strMsg = strMsg & "Delete" & vbCr & _
rv.Range.Text
Case wdRevisionProperty
strMsg = strMsg & "Property" & vbCr & _
rv.FormatDescription
Case Else
strMsg = strMsg & "No code yet"
End Select
MsgBox strMsg, , "Revision " & rv.Index
Loop
End Sub
 

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

Top