S
Stephen
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.
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.