#16
|
||||
|
||||
Quote:
Quote:
Quote:
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#17
|
|||
|
|||
Quote:
Thank you as always. |
#18
|
|||
|
|||
Sorry for the additional bump.
Would you mind explaining what this line of code means exactly? I am writing a similar macro that will take img html, and insert an image. If you would be able to pull this apart, I do think I can handle the image insertion myself Code:
.Text = "\<[Aa] href=([!\>]@)\>([!\<]@)\</a\>" |
#19
|
||||
|
||||
That's a Word wildcard Find expression. See: Finding and replacing characters using wildcards
It appears you're hijacking this thread for a different topic. Start new topics in new threads. And no, it won't help with the image insertion you've discussed at: VBA to insert image in current directory regardless of image type | VBA Express
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#20
|
|||
|
|||
Quote:
The request from this thread is actually different from the one on the VBAX forum. Either way thank you again for your help. |
#21
|
|||
|
|||
macropod... thank you again for your help thus far.
The code you helped with, which is below, strips out the bolded URL in the link format in my WordDoc. For instance it starts as this: <a href="https://developers.google.com/speed/pagespeed/insights/?url=websiteurl.com">PageSpeed Insights</a> And ends up linking to this (strips everything after the =): PageSpeed Insights Code:
Sub ConvertLinks() Dim StrAddr As String, StrDisp As String ' Turn Off Screen Updating Application.ScreenUpdating = False With ActiveDocument.Range With .Find .Text = "\<[Aa] href=([!\>]@)\>([!\<]@)\</a\>" .ClearFormatting .Replacement.ClearFormatting .Replacement.Text = "" .Forward = True .MatchWildcards = True .Wrap = wdFindStop .Execute End With Do While .Find.Found = True StrAddr = Replace(Replace(Replace(Split(Split(.Text, ">")(0), "=")(1), Chr(34), ""), Chr(147), ""), Chr(148), "") StrDisp = Split(Split(.Text, ">")(1), "<")(0) .Hyperlinks.Add Anchor:=.Duplicate, _ Address:=StrAddr, TextToDisplay:=StrDisp .Collapse wdCollapseEnd .Find.Execute Loop End With ' Restore Screen Updating Application.ScreenUpdating = True End Sub |
#22
|
||||
|
||||
Well, what you have with:
<a href="https://developers.google.com/speed/pagespeed/insights/?url=websiteurl.com">PageSpeed Insights</a> is a link though google to websiteurl.com, whereas you really should have: <a href="https://websiteurl.com">PageSpeed Insights</a> That said, you can resolve the matter by changing: "=" in the VBA code to: "href="
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#23
|
|||
|
|||
Quote:
Thanks for the reply, but looks like href= is already in the code I posted above? Code:
With ActiveDocument.Range With .Find .Text = "\<[Aa] href=([!\>]@)\>([!\<]@)\</a\>" |
#24
|
||||
|
||||
There is a "=" in the VBA code...
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
Tags |
a href, hyperlink, macro |
Thread Tools | |
Display Modes | |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
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 |