Calling a Macro from multiple places in Excel sheet

  • Thread starter Thread starter Robert Reid
  • Start date Start date
R

Robert Reid

I am using Excel 2003. I have a worksheet with multiple pictures in it. When
any of the pictures are clicked, a macro is called. I cannot figure out how
to determine which picture was clicked to call the macro. Any help would be
appreciated.

I apologize if this is a question from VBA101. I'm kinda slow. :)
 
I think Mike meant Application.caller.

Option Explicit
sub testme() 'assigned to all the pictures

Dim myPict as picture

set mypict = activesheet.pictures(application.caller)

msgbox mypict.name & vblf & mypict.topleftcell.address '

end wub
 
Dave,

Parent.caller works fine for me

Mike

Dave Peterson said:
I think Mike meant Application.caller.

Option Explicit
sub testme() 'assigned to all the pictures

Dim myPict as picture

set mypict = activesheet.pictures(application.caller)

msgbox mypict.name & vblf & mypict.topleftcell.address '

end wub
 
Yes, it does.

In this case, the parent is the application.

I don't think I've ever seen or used it in this way.
 
Back
Top