+ Reply to Thread
Results 1 to 4 of 4

Forgot how to assign a macro to a button object

  1. #1
    Steve Conover
    Guest

    Forgot how to assign a macro to a button object

    I created a macro, now I've forgotten how to assign it to a button
    object in the workbook. I tried right-clicking on the sizing handle,
    but the shortcut menu does not have "Assign Macro" on it. (The help
    system assumes it does and proceeds from there, leaving me behind.)

    Any suggestions?

    Thanks,
    Steve


  2. #2
    Registered User
    Join Date
    02-06-2005
    Posts
    12
    It depends whether the button is a user form button from the "Forms" menu or a control button from the "Control Toolbox" menu. If it is a forms button then it will have assign macro in the pullbown list so i am assuming you have used a control button.

    In this case the macro is hard coded to the button. You will either need to copy and paste the code into the buttons routine, right click then select view code, or double click on the macro.

    Alternatively you can run the macro from the buttons code. To do this place the following code behind the button.


    Private Sub CommandButton1_Click()

    Call "macro name"

    End Sub

    where "macro name" is the name of your macro but don't put it in commas.

    Hope that helps

  3. #3
    Dave Peterson
    Guest

    Re: Forgot how to assign a macro to a button object

    You used a commandbutton from the control toolbox toolbar.

    Delete that one and add the button from the Forms toolbar.

    Steve Conover wrote:
    >
    > I created a macro, now I've forgotten how to assign it to a button
    > object in the workbook. I tried right-clicking on the sizing handle,
    > but the shortcut menu does not have "Assign Macro" on it. (The help
    > system assumes it does and proceeds from there, leaving me behind.)
    >
    > Any suggestions?
    >
    > Thanks,
    > Steve


    --

    Dave Peterson

  4. #4
    Steve Conover
    Guest

    Re: Forgot how to assign a macro to a button object

    Thanks Dave, that worked.

    It's all coming back to me now.

    Steve


+ 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