Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
in vb, what is the 1-line code of assigning a macro using click
I am looking for a sample of the syntax where the macro name and click are on
the vb line. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
in vb, what is the 1-line code of assigning a macro using click
For a control from the forms toolbar:
Activesheet.Buttons(1).OnAction = "MyMacro" -- Regards, Tom Ogilvy "ExcelSuperUser" wrote: I am looking for a sample of the syntax where the macro name and click are on the vb line. |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
in vb, what is the 1-line code of assigning a macro using clic
sorry, not what i was looking for. let me give you more info. i set up a
command button in excel and would like to assign the macro to the button. if i right click, assign macro is not listed (not sure why) but if i go to the vb editor, i would like to type a line in that assigns the macro to the button. i seem to recall that it would have the button object, macro name and click on one line. i also recall that it is very simple and a basic statement. "Tom Ogilvy" wrote: For a control from the forms toolbar: Activesheet.Buttons(1).OnAction = "MyMacro" -- Regards, Tom Ogilvy "ExcelSuperUser" wrote: I am looking for a sample of the syntax where the macro name and click are on the vb line. |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
in vb, what is the 1-line code of assigning a macro using clic
I gave you the code to assign a macro to a button from the forms toolbar.
However, Command buttons from the control toolbox toolbar are not assigned to macros. They have build in events. To get to the Click event for the Commandbutton, right click on the sheet tab that contains the button and select view code. In the resulting sheet module, at the top of the module, in the left dropdown select Commandbutton1 (or the name of your command button) and in the right dropdown select Click. YOu will get the event Private Sub CommandButton1_Click() End sub You can put your code in this procedure/event. (including a call to a macro in a general module). -- regards, Tom Ogilvy "ExcelSuperUser" wrote: sorry, not what i was looking for. let me give you more info. i set up a command button in excel and would like to assign the macro to the button. if i right click, assign macro is not listed (not sure why) but if i go to the vb editor, i would like to type a line in that assigns the macro to the button. i seem to recall that it would have the button object, macro name and click on one line. i also recall that it is very simple and a basic statement. "Tom Ogilvy" wrote: For a control from the forms toolbar: Activesheet.Buttons(1).OnAction = "MyMacro" -- Regards, Tom Ogilvy "ExcelSuperUser" wrote: I am looking for a sample of the syntax where the macro name and click are on the vb line. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Macro code to put series name next to individual line in line grap | Charts and Charting in Excel | |||
Assigning Macro by using code | Excel Programming | |||
macro code for grouping adjacent cells into one multi-line cel | Excel Programming | |||
Using a macro to code a checkbox on click - Help | Excel Programming | |||
Assigning click event to OleObjects checkbox | Excel Programming |