Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #3  
Old 06-20-2011, 08:49 AM
njcloud njcloud is offline Convert html links into embedded hyperlinks Windows 7 64bit Convert html links into embedded hyperlinks Office 2010 64bit
Novice
Convert html links into embedded hyperlinks
 
Join Date: Jun 2011
Posts: 3
njcloud is on a distinguished road
Default

Thank you for your response, macropod. That would indeed be a good solution in many cases, but I'm afraid it can't be extended to my situation. I think I need to explain it a bit better - basically, I have many cells in excel that contain a paragraph of text each, and within each paragraph are multiple embedded hyperlinks. As they are right now, since excel can't *actually* handle embedded hyperlinks within cell text, I have them surrounded by these <a href...></a> tags. In order to avoid manually formatting each hyperlink in Word after the mail merge, I would like a macro to do it for me in one fell swoop (if possible).

I managed to find some macro code for a find and replace of the <a href> tags, but still could use some insight into how I could extract the web address and apply it to the plain text in between the <a href></a> tags. The below code might be a good start, and I semi-understand it.. I just know this must be possible somehow!

Thanks for your help!

Code:
Dim text As String
   Dim URL As String

   Selection.Find.ClearFormatting
   Selection.Find.Replacement.ClearFormatting
    With Selection.Find
        .text = "\<[Aa]*href=['""](*)['""]*\>(*)\</[Aa]\>"
        URL = "\1"
        text = "\2"
        
        .Replacement.text = text
        .Forward = True
        .Wrap = wdFindContinue
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchWildcards = True
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll
Reply With Quote
 

Tags
a href, hyperlink, macro



Similar Threads
Thread Thread Starter Forum Replies Last Post
Convert html links into embedded hyperlinks Embedded links spheon Word 1 06-07-2011 04:11 PM
convert html to text at opening etfjr Word 0 12-13-2010 11:14 AM
Can you actually write HTML and CSS in a word document and send it as an html page jackaroo Word 0 07-12-2010 07:49 AM
Word with frames, table of contents, and hyperlinks to html NHMC Word 0 12-09-2009 12:54 PM
Convert a file from HTML to WORD format weblayout view gtselvam Word 0 12-02-2008 03:53 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 02:44 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft