Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 03-27-2012, 03:58 PM
EricT EricT is offline word macro that reformats embedded links in a doc Windows 7 64bit word macro that reformats embedded links in a doc Office 2007
Novice
word macro that reformats embedded links in a doc
 
Join Date: Mar 2012
Posts: 2
EricT is on a distinguished road
Default word macro that reformats embedded links in a doc

Here's what I am trying to accomplish:

I want to add a subroutine into my word 2007 macro that will take the text and address for an embedded link in a document, and convert it to an href tag that uses the text as the display text, and the address for the html address.



So a line that appears as "go here to get to google" with a blue underline, and when clicked goes to www.google.com, gets replaced with:

<a target="_blank" href="http://www.google.com">go here to get to google</a>

This routine is to be added to an existing macro that I already have that does some other minor formatting, so no need for headers and whatnot.

That's it! If I am not explaining this well enough please don't hesitate to ask me any questions so I can clarify. Thanks!


Editing to add-

Played around with word a bit and I discovered the name of the structure I want to manipulate - I think.

ActiveDocument.Hyperlinks.Add Anchor:=Selection.Range, Address:= _
"www.google.com", _
SubAddress:="", ScreenTip:="", TextToDisplay:= _
"FBI Bulletin test display text", Target:="_blank"
Selection.Collapse Direction:=wdCollapseEnd

So it looks like the Address:="inside quotes" and TextToDisplay:= _"inside quotes" are the 2 variables I want to grab, store, and shove into the example string above, with that static code around it. I have a few lines in this macro that say, find underlined text, and replace with html tags around the text, but this one is a touch over my head.

I also want to make sure if there's 5 links in a page that I grab them all as well. Thanks again!

Last edited by EricT; 03-27-2012 at 06:37 PM. Reason: added content
Reply With Quote
 

Tags
link, macro, vba



Similar Threads
Thread Thread Starter Forum Replies Last Post
word macro that reformats embedded links in a doc Convert html links into embedded hyperlinks njcloud Mail Merge 23 02-04-2020 02:00 PM
word macro that reformats embedded links in a doc Can't open Office 2007 embedded as objects in Word DK8220 Word 5 11-02-2011 01:06 AM
word macro that reformats embedded links in a doc Macro to loop in subfolders, change links, export xml data Catalin.B Excel Programming 2 09-08-2011 11:37 PM
word macro that reformats embedded links in a doc Embedded links spheon Word 1 06-07-2011 04:11 PM
Embedded Excel in Word very slow to update delaneybob Word 0 02-11-2011 10:03 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 07:34 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