Is there a VB command method to execute a macro if the
Assign Macro doesn't show. Or is there something
changed I need to fix.
TIA
Dan Cring
Harald Staff - 10 Dec 2004 22:22 GMT
Hi Dan
Assign to what ? Just a guess; you're using a commandbutton from the
controls toolbox. They have their own macros. Choose "view code" (also
rightclick) and call your macro from that one, like
Private Sub CommandButton1_Click()
Call FantasticMacro
End Sub
HTH. Best wishes Harald
> Is there a VB command method to execute a macro if the
> Assign Macro doesn't show. Or is there something
> changed I need to fix.
> TIA
> Dan Cring
stanshoe - 10 Dec 2004 22:23 GMT
Dan-
Excel has two different toolbars, theForms toolbar and the Control Toolbox
toolbar, that contain Button controls which makes things confusing. If you
used the "Command Button" from the Control Toolbox toolbar you will not be
able to assign a marco. The "Command Button" from the Control Toolbox
toolbar uses the CommandButton_Click event to lauch macros.
Make sure you use the "Button" control from the Forms toolbar and you will
be able to right click to assign the macro.
-Stan Shoemaker
Palo Alto, CA
> Is there a VB command method to execute a macro if the
> Assign Macro doesn't show. Or is there something
> changed I need to fix.
> TIA
> Dan Cring
Ron de Bruin - 10 Dec 2004 22:23 GMT
Hi
You use a button from the control toolbox and not from the Forms toolbar
Press the first button on the control toolbox toolbar to go into the design
mode
Double click on the button you placed on your worksheet.
The VBA editor will open with this
Private Sub CommandButton1_Click()
End Sub
You can place the code in the event or place the macro name in the event.
Press Alt-q to go back to Excel and press the first button on the
control toolbox again to exit the design mode

Signature
Regards Ron de Bruin
http://www.rondebruin.nl
> Is there a VB command method to execute a macro if the
> Assign Macro doesn't show. Or is there something
> changed I need to fix.
> TIA
> Dan Cring
Tom Ogilvy - 10 Dec 2004 22:29 GMT
Sounds like you are using controls from the Control Toolbox Toolbar and
think you are using controls from the Forms Toolbar. Use the controls from
the Forms toolbar and you will be able to assign a macro. Controls from
the control toolbox Toolbar use events.
The articles will give some insight in to using Control Toolbox Toolbar
events: (they are for userforms, but using them on worksheets is similar).
http://support.microsoft.com/?id=168067
XL97: WE1163: "Visual Basic Examples for Controlling UserForms"
Microsoft(R) Visual Basic(R) for Applications Examples for Controlling
UserForms in Microsoft Excel 97
This Application Note is an introduction to manipulating UserForms in
Microsoft Excel 97. It includes examples and Microsoft Visual Basic for
Applications macros that show you how to take advantage of the capabilities
of UserForms and use each of the ActiveX controls that are available for
UserForms
http://www.microsoft.com/ExcelDev/Articles/sxs11pt1.htm
Lesson 11: Creating a Custom Form
Excerpted from Microsoft? Excel 97 Visual Basic? Step by Step.
Here is an article about using Control Toolbox Toolbar controls on a
worksheet:
http://www.microsoft.com/ExcelDev/Articles/activexl.htm
Using ActiveX Controls on a Microsoft Excel Worksheet

Signature
Regards,
Tom Ogilvy
--
Regards,
Tom Ogilvy
> Is there a VB command method to execute a macro if the
> Assign Macro doesn't show. Or is there something
> changed I need to fix.
> TIA
> Dan Cring