PC Review


Reply
Thread Tools Rate Thread

Calling a Macro from multiple places in Excel sheet

 
 
Robert Reid
Guest
Posts: n/a
 
      1st Dec 2009
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.
 
Reply With Quote
 
 
 
 
Mike H
Guest
Posts: n/a
 
      1st Dec 2009
Hi,

Parent.Caller

will give the name of the picture that called the macro

Mike

"Robert Reid" wrote:

> 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.

 
Reply With Quote
 
Dave Peterson
Guest
Posts: n/a
 
      1st Dec 2009
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

Mike H wrote:
>
> Hi,
>
> Parent.Caller
>
> will give the name of the picture that called the macro
>
> Mike
>
> "Robert Reid" wrote:
>
> > 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.


--

Dave Peterson
 
Reply With Quote
 
Robert Reid
Guest
Posts: n/a
 
      1st Dec 2009
Thanks for the response. And, like I said, VBA101.

"Mike H" wrote:

> Hi,
>
> Parent.Caller
>
> will give the name of the picture that called the macro
>
> Mike
>
> "Robert Reid" wrote:
>
> > 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.

 
Reply With Quote
 
Mike H
Guest
Posts: n/a
 
      1st Dec 2009
Dave,

Parent.caller works fine for me

Mike

"Dave Peterson" wrote:

> 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
>
> Mike H wrote:
> >
> > Hi,
> >
> > Parent.Caller
> >
> > will give the name of the picture that called the macro
> >
> > Mike
> >
> > "Robert Reid" wrote:
> >
> > > 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.

>
> --
>
> Dave Peterson
> .
>

 
Reply With Quote
 
Dave Peterson
Guest
Posts: n/a
 
      1st Dec 2009
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.

Mike H wrote:
>
> Dave,
>
> Parent.caller works fine for me
>
> Mike
>
> "Dave Peterson" wrote:
>
> > 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
> >
> > Mike H wrote:
> > >
> > > Hi,
> > >
> > > Parent.Caller
> > >
> > > will give the name of the picture that called the macro
> > >
> > > Mike
> > >
> > > "Robert Reid" wrote:
> > >
> > > > 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.

> >
> > --
> >
> > Dave Peterson
> > .
> >


--

Dave Peterson
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Multiple Check Boxes calling same macro =?Utf-8?B?UGF1bA==?= Microsoft Excel Programming 3 11th Jul 2007 12:01 PM
using excel macro how to copy sheet multiple time i.e. 100 =?Utf-8?B?cm1jYXJ0ZXI=?= Microsoft Excel Crashes 1 23rd Feb 2005 12:03 AM
Help Calling Pix With Macro-Affects All Pix on Sheet documike Microsoft Excel Discussion 8 9th Jan 2005 06:54 PM
Calling Procedures from another excel sheet by passing objects Thomas Auburn Microsoft Excel Programming 0 5th May 2004 05:33 PM
Excel Macro for multiple sheet ?? somu Microsoft Excel Programming 3 14th Feb 2004 01:07 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:19 PM.