Link to home
Start Free TrialLog in
Avatar of Mik Mak
Mik Mak

asked on

Word 2010 assign Hyperlink to Sub code

I'm struggling a bit assigning  a hyperlink to a Sub containing some vba code in Word 2010 - like it's possible in PowerPoint

I've tried the ActiveDocument.Hyperlinks.Item (1).Address ="RunTheDamnedSub" but without success - please advice :)

Thanks Michael
Avatar of Shums Faruk
Shums Faruk
Flag of India image

Hi,

You need to specify full path as below example, please try below changing your range:
ActiveDocument.Hyperlinks.Add Anchor:=Selection.Range, Address:="RunTheDamnedSub", _
        SubAddress:=Selection, ScreenTip:="", TextToDisplay:=Selection

Open in new window

Avatar of Mik Mak
Mik Mak

ASKER

Hi
thank you for you input - but the hyperlink is already there - so no need to Add ( Item(1) )

- and more importantly  the Selection.Range and Selection you mention is not valid in Word ?
ASKER CERTIFIED SOLUTION
Avatar of GrahamSkan
GrahamSkan
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Please try this link which guides to assign Macro with Macro Button:
MacroButton Fields - not just for macros anymore!
Avatar of Mik Mak

ASKER

I was trying to assign the hyperlink to a Picture, but this could be a good alternative :)