Convert html links into embedded hyperlinks
Hello,
I am using mail merge to import large text strings from an Excel document into Word. The final Word document needs to have embedded hyperlinks, however, which presents an interesting challenge.
One cannot use concatenate to create an embedded hyperlink within an excel cell, so I thought I could include the hyperlinks using identifying tags, and then use a macro to process the mail-merged document to convert the tagged links into embedded links.
I am using <a href...></a> tags simply because it's logical to me, but any unique identifier would do. Basically, after the merge I will get a paragraph much like this:
"Savings increase with the size of the network; however, <a href="http://www.hsp-central.net/Power_Study.pdf"> one study </a> demonstrated energy savings between 30 and 60% over conventional computers..."
And I want to turn the <a href> identified hyperlink and enclosed text (in this case "one study") into a clickable hyperlink. I would like to process the entire document to detect <a href="> tags and make the change in each case.
I imagine that the macro would take the text from between the > and </a>, and apply a hyperlink field code to it, using the <a href=" "> address.
I do not know how to do this on my own, or where to start. The most complex macro I have programmed prior to this was to change table background colours.
Any guidance or pointers would be much appreciated. I'm not expecting a fully coded solution (although that would be nice)! I'm sure I will learn a lot from this.
Thank you for your help!
|