Creating a hyperlink in Word from Excel

A

Ariel

I am creating a word document using Excel and I need to add a hyperlink at a
given position in the text. For some reason the following code does not work.
WordApp has already been dim'ed.


With WordApp.ActiveDocument
.Hyperlinks.Add Anchor:=Selection.Range, Address:= _
"http://www.asdfasdfasfd.com", SubAddress:="", _
ScreenTip:="", TextToDisplay:="Activity"
End With
 
D

Dave Peterson

About the only thing I do with MSWord is record macros and try to tweak them.

But Selection.Range doesn't look like it belongs to the MSWord application.

I'd try:

With WordApp.ActiveDocument
.Hyperlinks.Add Anchor:=.Range, Address:= _
"http://www.asdfasdfasfd.com", SubAddress:="", _
ScreenTip:="", TextToDisplay:="Activity"
End With
 
A

Ariel

Without specifically defining the location where this should be inserted,
everything else in the document is deleted.
 
D

Dave Peterson

Maybe it's time to ask in an MSWord newsgroup.


Without specifically defining the location where this should be inserted,
everything else in the document is deleted.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top