Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 10-30-2015, 12:10 PM
LeoStar LeoStar is offline Find hyperlinks Windows 7 32bit Find hyperlinks Office 2013
Novice
Find hyperlinks
 
Join Date: Oct 2015
Posts: 3
LeoStar is on a distinguished road
Default 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?
Reply With Quote
  #2  
Old 10-30-2015, 01:14 PM
macropod's Avatar
macropod macropod is offline Find hyperlinks Windows 7 64bit Find hyperlinks Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,962
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

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]
Reply With Quote
  #3  
Old 10-30-2015, 01:51 PM
LeoStar LeoStar is offline Find hyperlinks Windows 7 32bit Find hyperlinks Office 2013
Novice
Find hyperlinks
 
Join Date: Oct 2015
Posts: 3
LeoStar is on a distinguished road
Default

Address and display text.
Reply With Quote
  #4  
Old 10-30-2015, 02:07 PM
macropod's Avatar
macropod macropod is offline Find hyperlinks Windows 7 64bit Find hyperlinks Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,962
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
  #5  
Old 10-30-2015, 02:30 PM
LeoStar LeoStar is offline Find hyperlinks Windows 7 32bit Find hyperlinks Office 2013
Novice
Find hyperlinks
 
Join Date: Oct 2015
Posts: 3
LeoStar is on a distinguished road
Default

Thank you very much!
Reply With Quote
Reply

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 hyperlinks Find where find text contains a double quote norgro Word VBA 1 01-23-2015 10:58 PM
Find hyperlinks Find what box in Find and replace limits the length of a search term Hoxton118 Word VBA 7 06-10-2014 05:05 AM
Find hyperlinks 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

Other Forums: Access Forums

All times are GMT -7. The time now is 07:04 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft