Is there a way to extract all the hyperlinks in a Word document and list them in a table with the Text to Display in col 1 and the hyperlink in Col 2?
Is there a way to extract all the hyperlinks in a Word document and list them in a table with the Text to Display in col 1 and the hyperlink in Col 2?
Alas Babylon's Trivia Questions
Three questions a day, Monday through Friday.
To join, send e-mail to alasbabylon@gmail.com with SUBSCRIBE in the subject line.
To leave, send e-mail to alasbabylon@gmail.com with UNSUBSCRIBE in the subject line
http://groups.google.com/group/AlasBabylon?lnk=li
Hi Alasbabylon.
Finding hyperlinks with vba is easy: Simply look for hyperlink fields via the fields collection. Copying & inserting the hyperlink fields (or just their properties) into a table isn't especially difficult either.
What have you tried so far?
Cheers
Paul Edstein
[Fmr MS MVP - Word]
I haven't really tried anything yet - I don't know where to start. I thought I could do a search, but hyperlinks is not a search field - at least, noit in the Find dialog box. I'm don't have any VBA skills.
Alas Babylon's Trivia Questions
Three questions a day, Monday through Friday.
To join, send e-mail to alasbabylon@gmail.com with SUBSCRIBE in the subject line.
To leave, send e-mail to alasbabylon@gmail.com with UNSUBSCRIBE in the subject line
http://groups.google.com/group/AlasBabylon?lnk=li
Hi Alasbabylon.
Here's some vba code to get you started. It's even simpler than working through the fields collection. Whn it finds a hyperlink it reports the hyperlink address and screen tip. I haven't included the code to write anything to a table for two reasons:
1. You should spend a bit of time learning how to use vba; and
2. You haven't given enough information about the table (eg does it already exist, if so, where is it, and can I rely on it already having enough rows).
For your purposes, you need to replace the message box with the code tho output the same details to the table.Sub FindHyperlinks() Dim hLnk As Hyperlink For Each hLnk In ActiveDocument.Hyperlinks MsgBox hLnk.Address & vbCrLf & hLnk.ScreenTip Next hLnk End Sub
Cheers
Paul Edstein
[Fmr MS MVP - Word]