Solved: Hyperlink TEXT not TextFrame, PPT help!!
Hi, I'm killing myself trying to get VBA to hyperlink specific text within a TextFrame without hyperlinking the entire TextFrame! I'm using regular expressions to recognize specific patterns and provide a hyperlink based based on a generic URL. The code below, no matter how I try to revise it, links ALL the text within the range (shape). :dunno
Any help vastly appreciated!
THANKS!
-Tim
Here's the code:
For Each sld In Application.ActivePresentation.Slides
For Each shp In sld.Shapes
If shp.HasTextFrame Then
Set txtRng = shp.TextFrame.TextRange
For Each m In re.Execute(txtRng)
fullURL = URL1 + m.Value + URL2
stop = m.Length
With shp.TextFrame.TextRange.Characters(m.FirstIndex, stop)
With .ActionSettings(ppMouseClick)
.Action = ppActionHyperlink
.Hyperlink.Address = fullURL
End With
End With
Next
End If
Next
Next
Re: Hyperlink TEXT not TextFrame
Tom,
Thanks for the correction- accidentally grabbed from an older file. Here's my working (but not as desired!) tagged code.
Tim
[vba]
For Each sld In Application.ActivePresentation.Slides
For Each shp In sld.Shapes
If shp.HasTextFrame Then
Set txtRng = shp.TextFrame.TextRange
For Each m In re.Execute(txtRng)
fullURL = URL1 + m.Value + URL2
With shp.TextFrame.TextRange.Characters(m.FirstIndex, m.Length)
With .ActionSettings(ppMouseClick)
.Action = ppActionHyperlink
.Hyperlink.Address = fullURL
End With
End With
Next
End If
Next
Next
[/vba]
Still haven't hacked this one...
FYI: Short on patience for this one, be willing to offer a token of appreciation perhaps in exchange for the time if anyone can help me crack this one soon. Thanks...:cool: