Thread: Find hyperlinks
View Single Post
 
Old 10-30-2015, 02:07 PM
macropod's Avatar
macropod macropod is offline Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,467
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Try the following. It gives you the choice of making a listing at the end of the current document or in a new one.
Code:
Sub ListHyperlinks()
Application.ScreenUpdating = False
Dim HLnk As Hyperlink, StrTxt As String, Dest
Dim wdDocIn As Document, wdDocOut As Document
Dest = MsgBox(Prompt:="Output to New Document? (Y/N)", _
  Buttons:=vbYesNoCancel, Title:="Destination Selection")
If Dest = vbCancel Then Exit Sub
Set wdDocIn = ActiveDocument
If Dest = vbYes Then Set wdDocOut = Documents.Add
If Dest = vbNo Then Set wdDocOut = wdDocIn
StrTxt = vbCr & "Hyperlink Display Text" & vbTab & "Hyperlink Address"
With wdDocIn
  For Each HLnk In .Hyperlinks
    StrTxt = StrTxt & vbCr & HLnk.TextToDisplay & vbTab & HLnk.Address
  Next HLnk
End With
wdDocOut.Range.InsertAfter StrTxt
Set wdDocIn = Nothing: Set wdDocOut = Nothing
Application.ScreenUpdating = True
End Sub
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote