+ Reply to Thread
Results 1 to 2 of 2

? activate a commandbutton in code ?

  1. #1
    Registered User
    Join Date
    10-03-2005
    Posts
    10

    ? activate a commandbutton in code ?

    does anybody know how to activate a commandbutton in a macro?

    (there is no way around me having to do this... i need to batch a very poorly organized workbook, and i have to go through a commandbutton to do so)

    to activate the commandbutton normally you just "click" it with the mouse. but i cant figure out how to do it in a macro. i want to automate this workbook so i can run this program multiple times. ive tried dozens of different lines and none work. ive also tried recording a macro to show me the correct code but the recorder stops when you try to do this.

    !!! PLEASE - SOMEONE HELP !!!

  2. #2
    Tom Ogilvy
    Guest

    Re: ? activate a commandbutton in code ?

    Change the click event from Private to public, then you just call the event
    in your code.

    Private Sub Commandbutton1_Click()
    changed to
    Public Sub Commandbutton1_Click()

    then call it with

    Sheet1!CommandButton1_Click'

    where Sheet1 is the code name of the sheet containing the code.

    --
    Regards,
    Tom Ogilvy

    "tad_wegner" <[email protected]> wrote
    in message news:[email protected]...
    >
    > does anybody know how to activate a commandbutton in a macro?
    >
    > (there is no way around me having to do this... i need to batch a very
    > poorly organized workbook, and i have to go through a commandbutton to
    > do so)
    >
    > to activate the commandbutton normally you just "click" it with the
    > mouse. but i cant figure out how to do it in a macro. i want to
    > automate this workbook so i can run this program multiple times. ive
    > tried dozens of different lines and none work. ive also tried recording
    > a macro to show me the correct code but the recorder stops when you try
    > to do this.
    >
    > !!! PLEASE - SOMEONE HELP !!!
    >
    >
    > --
    > tad_wegner
    > ------------------------------------------------------------------------
    > tad_wegner's Profile:

    http://www.excelforum.com/member.php...o&userid=27770
    > View this thread: http://www.excelforum.com/showthread...hreadid=474762
    >




+ 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