Results 1 to 6 of 6

Thread: Find and Replace with Hyperlink Doc from Excel - 438 Error

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #3
    Thank you! This works but it does not fully format the text outside of the 1 digits. For example, in the word doc Test 1 looks like Test 1 and Test 10 looks like Test 10. The hyperlinks all go to the correct addresses though. I wrote the below to change the link formatting. I was wondering if there is a better way to do this.

    Private Sub Document_()
    Dim i As Integer
    On Error Resume Next
    
    For i = 1 To 100
        With ActiveDocument.Content.Find
            .Text = "Test Exhibit" + CStr(i)
        With .Replacement
            .Text = "Test Exhibit" + CStr(i)
            .Font.Underline = True
            .Font.ColorIndex = RGB(0, 0, 255)
        End With
        .Execute FindText:="", ReplaceWith:="", _
        Format:=True, Replace:=wdReplaceAll
    End With
    Next
    End Sub
    Last edited by sferrier; 03-17-2019 at 08:25 PM.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •