Assign a macro to Command Button Object

G

Guest

When I right click on my command Button to locate the option of assign to
macro its not their. How do I get the option to assign to macro to appear?
The other options are available to me on the command button but not the
assign to macro???
 
N

Norman Jones

Hi Dallin,

If the button is from the Control Toolbox, double-click the button which
will take you to the sheet module and provide you with a macro stub for the
CommandButton something like:


Private Sub CommandButton1_Click()

End Sub


Insert insert the body of your macro between the two stub lines.

Alternatively, if the macro you want to use is in a standard module, simply
add the line:

Call MyMacro

between the stub lines, replacing 'MyMacro' with the name of your macro.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top