RE: Revision Object

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



The code sample runs fine on my samples (but that’s not saying much since
documents vary so much). However, there are known problems with revisions,
mainly that the internal link list gets corrupted over time. This is seen by
either entering a endless loop as it points back to itself, or the pointer
goes off to random location. Without more information, the problem is likely
to the second case, a bad pointer. The fix is difficult. The revision list
can’t be patched or repaired, short of deleting all revisions.

A more convenient workaround is to include an error handler that attempts to
skip the problem. In writing this handling, you should count the consecutive
times the error is hit (getting more than several, such as 100 indicates
you’ve entered a loop or bad pointer. Another option is to use a indexed for
loop based on the revisions count; but that’s not necessarily a much better
fix. Finally, try restarting the revision list at an arbitrary point such as
the one third position, or the half way point, hoping to skip the bad links.
Other than that, the news isn’t good.

"Stephen" wrote:


From Word 2003, when I run the code to loop through all revisons marks, I
get an error "object is required" in some cases. So what should I do to
avoid this error? Any help would be appreciated.

For Each oRev In Application.ActiveDocument.Revisions

If Not (oRev Is Nothing) Then

If oRev.Type = wdRevisionDelete Or oRev.Type =
wdRevisionInsert Or oRev.Type = wdRevisionReplace Then
If strUser = "" And strDate = "" And bIsCheckHighlight
Then
oRev.Range.HighlightColorIndex = m_colorHighlight
ElseIf Not (strUser = "") And bIsCheckHighlight Then
If UCase(oRev.Author) = UCase(strUser) Then
oRev.Range.HighlightColorIndex = m_colorHighlight
ElseIf Not (UCase(oRev.Author) = UCase(strUser)) Then
oRev.Range.HighlightColorIndex = wdNoHighlight
End If
ElseIf Not (strDate = "") And bIsCheckHighlight Then
If DateValue(oRev.Date) = DateValue(CDate(strDate))
Then
oRev.Range.HighlightColorIndex = m_colorHighlight
End If
Else
oRev.Range.HighlightColorIndex = wdNoHighlight
End If

End If

'If MsgBox(Print_Debug(oRev), vbOKCancel) = vbCancel Then
'Exit Sub
'End If

End If

Next oRev


Thanks in advance.



.



Relevant Pages

  • Re: What is the difference between for..if, case statements, do..while
    ... ElseIf Then ... It can not execute both This and That or any ... Loop Until ... Do while an loop until cause you to loop throgh the same st of instructions ...
    (microsoft.public.excel.programming)
  • Re: What is the difference between for..if, case statements, do..while
    ... ElseIf Then ... It can not execute both This and That or any ... Loop Until ... Do while an loop until cause you to loop throgh the same st of instructions ...
    (microsoft.public.excel.programming)
  • Re: Counter
    ... Use the Select Case statement as an alternative to using ElseIf in ... combination of values and comparison operators. ... > ActiveCell = Counter ... How do I then tell the Counter to only loop through these ...
    (microsoft.public.excel.programming)
  • Re: Number of connected nonzero element in a vector
    ... element in a logical vector how many directly connected same ... %if the next element is not equal set the starting ... % loop for each element of vectorA ... elseif(A1(i)) ...
    (comp.soft-sys.matlab)
  • Re: a row-level operator for copying?
    ... has historical data. ... code sample below, these tables are atest and atest_history). ... If you gotta have the first PUT_LINE you can use the loop for that, ...
    (comp.databases.oracle.misc)