CAmossy
CAmossy

Reputation: 11

Creating a hyperlink in vba

I want to create a hyperlink between two bookmarks in VBA word. Here is the code I have come up with, I get a type mismatch error and am unsure why

ActiveDocument.Hyperlinks.Add 
Anchor:=ActiveDocument.Bookmarks("TableOfContents_KeyBenefits"), _
Address:=ActiveDocument.Bookmarks, SubAddress:="KeyBenefitsTarget"

Upvotes: 0

Views: 326

Answers (1)

Tim Williams
Tim Williams

Reputation: 166850

ActiveDocument.Hyperlinks.Add _
     Anchor:=ActiveDocument.Bookmarks("TableOfContents_KeyBenefits").Range, _
     Address:=ActiveDocument.FullName, SubAddress:="KeyBenefitsTarget"

Upvotes: 2

Related Questions