detecting shape clicked on

  • Thread starter Thread starter notsureofthatinfo
  • Start date Start date
N

notsureofthatinfo

Is there a way for me to tell which shape is clicked on within an
image mapped in html and pasted into a worksheet? I want to use the
AlternativeText for the ShapeRange as a variable string to run a query
and pull data.

I posted this elsewhere but haven't seen any responses yet.
Thank You,

Scott
 
A mapped image is pasted into excel as a grouped shape
each mapped area becomes a groupitem of that group.
some items have there own hyperlink

You could delete the hyperlinks and replace them
with a call to a macro...


I copied the first (mapped) image from http://www.ihip.com/
start with the word convert select to begin.
Pastespecial into excel...

I had to kill the hyperlink as these take precendence
over the onaction...

you could embelish by storing the deleted hyperlink into an array
or collection which is then used by macro1...


and made this procedure to tell which is which

Sub ConvertMapHLtoMacro()
Dim grpSh As GroupShapes
Dim itmSh As Shape
Dim hl As Hyperlink

On Error Resume Next
Set grpSh = ActiveSheet.Shapes("Group 1").GroupItems
If Not grpSh Is Nothing Then
For Each itmSh In grpSh
Set hl = itmSh.Hyperlink
If Not hl Is Nothing Then
itmSh.OnAction = "macro1"
hl.Delete
End If
Next
End If
End Sub

Sub macro1()
Dim c
c = Application.Caller
MsgBox "you clicked on: " & c
End Sub




keepITcool

< email : keepitcool chello nl (with @ and .) >
< homepage: http://members.chello.nl/keepitcool >
 
Back
Top