+ Reply to Thread
Results 1 to 3 of 3

Get / extract a button name

  1. #1
    Oener
    Guest

    Get / extract a button name

    Hi,

    I have a button "C2".
    I want to get the name of the button in VBA to point on the cell C2.
    How do I get the name of the button without using the name of the button?

    With use:
    Dim whatIwant as variant
    whatIwant = Me.C2.Name
    --> whatIwant=C2

    is there a way like:
    whatIwant = Mebutton.Name
    ???

    Kindly
    Oener

  2. #2
    ben
    Guest

    RE: Get / extract a button name

    You want to get the name without using the name???? Sorry not quite certain
    what you are asking for.
    you could loop through all the controls on the userform and see if any of
    them match criteria
    dim con as control
    for each con in me.controls
    if 'criteria code here
    whatiwant = con.name
    end if
    next

    ben

    "Oener" wrote:

    > Hi,
    >
    > I have a button "C2".
    > I want to get the name of the button in VBA to point on the cell C2.
    > How do I get the name of the button without using the name of the button?
    >
    > With use:
    > Dim whatIwant as variant
    > whatIwant = Me.C2.Name
    > --> whatIwant=C2
    >
    > is there a way like:
    > whatIwant = Mebutton.Name
    > ???
    >
    > Kindly
    > Oener


  3. #3
    Oener
    Guest

    RE: Get / extract a button name

    The problem is much greater:
    I have a field C2 ("[email protected]").
    With a click on a button, Outlook generates an email with Body, Subject,
    Attachment and Signatur. But I want that the email-Adress for the To-Field is
    taken from C2.

    Therefore I thought, that I can provide this field dynamic, so that VBA
    takes the Name of the Button (in this Case C2) and after that it chooses the
    field C2, lookes inside, takes the adress in C2 and puts it in the To-Field!

    Do I want to much?
    I know everything about that process but now idea how to query the the name
    of the button in that button.

    So I hope someone can help me.

    "ben" wrote:

    > You want to get the name without using the name???? Sorry not quite certain
    > what you are asking for.
    > you could loop through all the controls on the userform and see if any of
    > them match criteria
    > dim con as control
    > for each con in me.controls
    > if 'criteria code here
    > whatiwant = con.name
    > end if
    > next
    >
    > ben
    >
    > "Oener" wrote:
    >
    > > Hi,
    > >
    > > I have a button "C2".
    > > I want to get the name of the button in VBA to point on the cell C2.
    > > How do I get the name of the button without using the name of the button?
    > >
    > > With use:
    > > Dim whatIwant as variant
    > > whatIwant = Me.C2.Name
    > > --> whatIwant=C2
    > >
    > > is there a way like:
    > > whatIwant = Mebutton.Name
    > > ???
    > >
    > > Kindly
    > > Oener


+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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