I was trying to record a macro in word 2013 that would automatically insert a copied hyperlink into selected text on click of a button.
The ideal operation would be:
- Copy hyperlink from browser.
- Select text in Word
- Click macro button to insert copied hyperlink
Essentially, what I'm trying to do is reduce "Ctrl+K - Ctrl+V - Enter" to a button. The macro recorded as follows:
Sub Hyperlink()
'
' Hyperlink Macro
'
'
Selection.MoveLeft Unit:=wdCharacter, Count:=5, Extend:=wdExtend
ActiveDocument.Hyperlinks.Add Anchor:=Selection.Range, Address:= _
"http://www.greenoptimistic.
" _
, SubAddress:="", ScreenTip:="", TextToDisplay:="test"
End Sub
I attempted to record the macro after selecting some random text, but all it does when I try to run the macro is use the original information from when I recorded the macro.
I hope my question makes sense. Thanks ahead for your answers.