|
|
|
date: Thu, 18 Sep 2008 08:07:02 -0700,
group: microsoft.public.word.vba.general
back
RE: Revision Object
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.
>
>
>
date: Thu, 25 Sep 2008 08:58:01 -0700
author: George Lee
|
|