View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Rand[_2_] Rand[_2_] is offline
external usenet poster
 
Posts: 1
Default Adding a hyperlink to a shape

I have been trying to add a hyperlink to a shape using the following in
Excel 2002:


ActiveSheet.Shapes("Object 1").Select
ActiveSheet.Hyperlinks.Add Anchor:=Selection.ShapeRange.Item(1),
Address:= _
"http://www.cas.org/"

This code was generated by recording a macro. The hyperlink was successfully
added during the recording, and works just fine.

However, when I run this recorded macro, I get a:

Run-time error '5':
Invalid procedure call or argument

After a little experimentation, I found I can add a Range object as an
Anchor, but not a Shape object as the documentation indicates that I should.

Does anyone have a solution to this problem?

Thanks,

Rand