#1
|
|||
|
|||
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 |
Tags |
link, macro, vba |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Convert html links into embedded hyperlinks | njcloud | Mail Merge | 23 | 02-04-2020 02:00 PM |
Can't open Office 2007 embedded as objects in Word | DK8220 | Word | 5 | 11-02-2011 01:06 AM |
Macro to loop in subfolders, change links, export xml data | Catalin.B | Excel Programming | 2 | 09-08-2011 11:37 PM |
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 |