Hyperlinking to an Autoshape?

  • Thread starter Thread starter James Cox
  • Start date Start date
J

James Cox

Autoshapes have hyperlink attributes, so it's easy to hyperlink from a
autoshape to a cell, named range, file or url.

But, is there any way to hyperlink *TO* an autoshape? The best I've been
able to do is to use the TopLeftCell / BottomRightCell to get a range to
hyperlink to, but with row / column inserts or just moving the autoshape,
that range rapidly gets out-of-sync with the actual autoshape location.

Any thoughts will be most appreciated!

James
 
WEll, poking around a bit more, I see that Access has the ability to
hyperlink to an object, but from all I can tell by looking at the Excel
Hyperlink object, Excel only supports hyperlinking to a location with a
string address. In terms of hyperlinking within a workbook, that seems to
limit it to cells, ranges of cells or named ranges - and "static" locations,
at that (only a hyperlink to a named range keeps the appropriate destination
if rows/columns are added/deleted).

(Sigh) Any chance there in some MS reference that I could enable that would
give Excel the ability to link to an object?

Again, thanks for at least reading this, even if nothing came to mind when
you did!

James
 
James,
How about a workaround solution?
Why not try defining the hyperlink to a known cell (off-page, perhaps). Then
use the WorkSheet_FollowHyperlink event (or Workbook_FollowHyperlink event)
to identify the link action, and use a small macro to select or show the
shape. You could event give the shape and the cell the similar names so that
the code would not need to do lookups.

I built:

Cell B1 with range name "SH1_Rng"
Cell A1 with Hyperlink "Goto SH1_Rng"
A Rectangle named "SH1"

and then I wrote the sub below on the sheet object:

Private Sub Worksheet_FollowHyperlink(ByVal Target As Hyperlink)

Dim ShapeName As String
ShapeName = Left(Target.SubAddress, 3)
Me.Shapes(ShapeName).Select

End Sub

and it works!

Give it a try.

Alex
 
Back
Top