Quantcast
Channel: VBForums
Viewing all articles
Browse latest Browse all 42225

Replace "Text to display" of ALL hyperlinks within selection with the word "LINK"

$
0
0
Hi, I would like to replace all the hyperlinks with a one word string, like "Link", however, the actual hyperlink should remain unchanged. I'm sure there is a very simple way, however, I'm pretty new in this field and any help would be highly appreciated. So far, I recorded the macro as below:

Sub Macro1()
'
' Macro1 Macro
'
'
Selection.Range.Hyperlinks(1).Range.Fields(1).Result.Select
Selection.Range.Hyperlinks(1).Delete
ActiveDocument.Hyperlinks.Add Anchor:=Selection.Range, Address:= _
"http://www.yahoo.com/", SubAddress:="", ScreenTip:="", TextToDisplay:= _
"Link"
Selection.Collapse Direction:=wdCollapseEnd
End Sub


It works, BUT, it also changes all the hyperlink address to yahoo.com which is bad.

Please help.

Viewing all articles
Browse latest Browse all 42225


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>