#1
|
|||
|
|||
Find hyperlinks
Hi! I need to write macro to find all hyperlinks and create list of them at the end of the document . Could anybody help me?
|
#2
|
||||
|
||||
What do you need to list about them - the page #, address, sub address, display text, screen tip, something else?
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#3
|
|||
|
|||
Address and display text.
|
#4
|
||||
|
||||
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] |
#5
|
|||
|
|||
Thank you very much!
|
Thread Tools | |
Display Modes | |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
find IP in range / find number between numbers | gn28 | Excel | 4 | 06-14-2015 03:46 PM |
Find where find text contains a double quote | norgro | Word VBA | 1 | 01-23-2015 10:58 PM |
Find what box in Find and replace limits the length of a search term | Hoxton118 | Word VBA | 7 | 06-10-2014 05:05 AM |
Bad view when using Find and Find & Replace - Word places found string on top line | paulkaye | Word | 4 | 12-06-2011 11:05 PM |
Find Hyperlinks | jimbassett | Excel | 2 | 02-08-2010 08:08 AM |