Reply
 
Thread Tools Display Modes
  #1   Report Post  
zcrane zcrane is offline
Junior Member
 
Posts: 0
Default Macro to Extract URL from Hyperlink and Insert on New Line?

Hi All - I'm really hoping someone can help me with this one, as it will save a tremedous amount of time.

I have a few very lengthy documents that are in outline form. Scattered throughout each of the documents are hyperlinks. I need to take the URL that the hyperlink points to and paste it below the line containing the hyperlink. For example:

Before --
A3. Search Engines
a. One of the most popular - Google

After --
A3. Search Engines
a. One of the most popular - Google
www.google.com

Where the "Google" text in the "before example" is a hyperlink to www.google.com

Is there any way that I can acomplish this in Word 2010 via an automated method?

Thank you in advance for the assistance. I greatly appreciate it!

Last edited by zcrane : June 20th 12 at 07:41 PM
  #2   Report Post  
zcrane zcrane is offline
Junior Member
 
Posts: 0
Default

This is currently what I have, but it does not function correctly.

Sub URLCapture()
'
' URLCapture Macro
'
'
Dim HLink As Hyperlink
Dim strAddress As String
For Each HLink In ActiveDocument.Hyperlinks
strAddress = HLink.Address
Selection.EndKey Unit:=wdLine
Selection.TypeParagraph
Selection.TypeText Text:=strAddress
Next HLink

End Sub

Quote:
Originally Posted by zcrane View Post
Hi All - I'm really hoping someone can help me with this one, as it will save a tremedous amount of time.

I have a few very lengthy documents that are in outline form. Scattered throughout each of the documents are hyperlinks. I need to take the URL that the hyperlink points to and paste it below the line containing the hyperlink. For example:

Before --
A3. Search Engines
a. One of the most popular - Google

After --
A3. Search Engines
a. One of the most popular - Google
www.google.com

Where the "Google" text in the "before example" is a hyperlink to www.google.com

Is there any way that I can acomplish this in Word 2010 via an automated method?

Thank you in advance for the assistance. I greatly appreciate it!
  #3   Report Post  
Posted to microsoft.public.word.docmanagement
Stefan Blom[_3_] Stefan Blom[_3_] is offline
external usenet poster
 
Posts: 6,897
Default Macro to Extract URL from Hyperlink and Insert on New Line?

Is the linked text always in a separate paragraph (that is, you typed Enter
between the text lines in your example)? In that case, you should be able to use
a macro that goes through each paragraph, extracts the URL of any hyperlink
present, and adds it in a new paragraph below.

--
Stefan Blom
Microsoft Word MVP





"zcrane" wrote in message
...

Hi All - I'm really hoping someone can help me with this one, as it will
save a tremedous amount of time.

I have a few very lengthy documents that are in outline form. Scattered
throughout each of the documents are hyperlinks. I need to take the URL
that the hyperlink points to and paste it below the line containing the
hyperlink. For example:

Before --
A3. Search Engines
a. One of the most popular - Google

After --
A3. Search Engines
a. One of the most popular - Google
www.google.com

Where the "Google" text in the "before example" is a hyperlink to
www.google.com

Is there any way that I can acomplish this in Word 2010 via an automated
method?

Thank you in advance for the assistance. I greatly appreciate it!




--
zcrane


Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
hyperlink url truncated... shesh Microsoft Word Help 4 October 10th 09 01:09 AM
URL in Hyperlink Filed in Access Ian McKeag[_2_] Microsoft Word Help 1 April 23rd 09 09:13 AM
Hide url in hyperlink Luis R. Microsoft Word Help 2 October 31st 07 10:21 PM
How to create an email from mail merge including a hyperlink, so that the value of a merged field is included as part of the hyperlink URL, not just part of its text. [email protected] Mailmerge 4 August 22nd 07 06:18 PM
How to create an email from mail merge including a hyperlink, so that the value of a merged field is included as part of the hyperlink URL, not just part of its text. [email protected] Mailmerge 0 August 17th 07 03:52 PM


All times are GMT +1. The time now is 10:05 AM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"