I have a macro that adjust a Word document based upon the type of revision it encounters. Works perfectly fine, unless the revision is the addition of a hyperlink - in this case, on an email address.
Debug shows it errors on Revision.Type. Code is below, and you can see this is just a Select Case on the Type. Error handling hasn't helped at all. It seems, from what I can tell, to just loop through that same hyperlink over and over and over. I added the debug.print orev.range just to catch where the error is, and it truly is on the hyperlink email - which debug printed out about 200 times before I hit Ctrl+Break. Any thoughts or ideas on forcing through this?
Sub RedLine()
Dim oRev As Revision
Dim I As Long, ErrMsg As String, a As Integer
'MsgBox ("Starting Macro")
a = 0
Application.ScreenUpdating = False
I = ActiveDocument.Revisions.count
On Error GoTo OhCrap
For Each oRev In ActiveDocument.Revisions
Debug.Print oRev.Range
Select Case oRev.Type
Case wdRevisionInsert, wdRevisionMovedTo
oRev.Range.HighlightColorIndex = wdGray25
Case Else
'do nothing
End Select
Next oRev
Application.ScreenUpdating = True
MsgBox ("Redline completed with " & a & " errors. Please review for accuracy.")
If a > 0 Then
MsgBox ("This file is being emailed to XX for further review.")
'Call EmailXX
End If
OhCrap:
Err.Clear
a = a + 1
Resume Next
End Sub
Bookmarks