+ Reply to Thread
Results 1 to 6 of 6

Find Object Initiating Sub

  1. #1
    Registered User
    Join Date
    07-09-2014
    Location
    Montreal, Quebec
    MS-Off Ver
    07
    Posts
    15

    Find Object Initiating Sub

    Hi,

    I'd like to know if it's possible to know which object is triggering an event. I'm using the same sub a couple of times and I'd prefer not to have to enter the whole name as a string each time.

    ex:
    Please Login or Register  to view this content.
    Thank you !!
    Last edited by domino111; 07-29-2014 at 03:45 PM.

  2. #2
    Registered User
    Join Date
    08-27-2013
    Location
    Texas
    MS-Off Ver
    Excel 2010
    Posts
    30

    Re: Find Object Initiating Sub

    Call Something("Button1")
    Send in a string variable so you can test what it is.

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    07-09-2014
    Location
    Montreal, Quebec
    MS-Off Ver
    07
    Posts
    15

    Re: Find Object Initiating Sub

    it's not quite what I'm looking for.. In fact I'm more looking for the equivalent of the "Me.Name" for a button or listbox, etc. So I wouldn't need to list all the possibilities

  4. #4
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Re: Find Object Initiating Sub


    Hi,

    maybe see Caller inner VBA help …

  5. #5
    Registered User
    Join Date
    07-09-2014
    Location
    Montreal, Quebec
    MS-Off Ver
    07
    Posts
    15

    Re: Find Object Initiating Sub

    Me.ActiveControl !!! (thanks to ozgrid)

  6. #6
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229

    Re: Find Object Initiating Sub

    You should look at the Application.Caller object.

    If the sub is called by a button on a sheet
    Please Login or Register  to view this content.
    _
    ...How to Cross-post politely...
    ..Wrap code by selecting the code and clicking the # or read this. Thank you.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 0
    Last Post: 06-19-2014, 02:09 PM
  2. Excel initiating email to Outlook automatically
    By dbement in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-08-2012, 12:25 PM
  3. Initiating an AddIn through VBA
    By Kaziglu Bey in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 04-26-2010, 01:21 PM
  4. Initiating a macro in a worksheet without a command button
    By Macster in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-22-2009, 05:22 AM
  5. initiating a macro
    By johnT in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 04-02-2005, 11:06 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1