View Single Post
 
Old 08-15-2017, 07:51 PM
saltire1963 saltire1963 is offline Windows 10 Office 2016
Novice
 
Join Date: Aug 2017
Posts: 2
saltire1963 is on a distinguished road
Default

Paul, sorry for late reply. I modified your suggestion to the code below and it worked a treat, many thanks.

Code:
Dim fso As FileSystemObject ' Declare a FileSystemObject.
Dim stream As TextStream ' Declare a TextStream.
Sub Demo()
    
    Dim i As Long, Rng As Range
    Dim strMid As String

    Set fso = New FileSystemObject ' Create a FileSystemObject.
    Set stream = fso.CreateTextFile("C\Test1.txt", True)  ' Create a TextStream.
    
    Application.ScreenUpdating = False
    
    With ActiveDocument
        For i = .Hyperlinks.Count To 1 Step -1
            strMid = Mid(.Hyperlinks(i).Address, 36, 75) '& vbCr
            stream.WriteLine (strMid)
        Next
    End With
    
    ' Close the file.
    stream.Close

    Application.ScreenUpdating = True
    
End Sub
Reply With Quote