Article ID: 157416 - View products that this article applies to.
This article was previously published under Q157416
This article has been archived. It is offered "as is" and will no longer be updated.
In Microsoft Excel 97, there is no menu command that allows you to assign a macro to an ActiveX control that is on a worksheet. This article provides an example that demonstrates how to create an ActiveX control and assign a macro to the control.
NOTE: If you drag the control to the worksheet from the Forms toolbar, you can right-click the control and click Assign Macro on the shortcut menu.
Microsoft provides programming examples for illustration only, without warranty either expressed or implied, including, but not limited to, the implied warranties of merchantability and/or fitness for a particular purpose. This article assumes that you are familiar with the programming language being demonstrated and the tools used to create and debug procedures. Microsoft support professionals can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific needs.
If you have limited programming experience, you may want to contact a Microsoft Certified Partner or Microsoft Advisory Services. For more information, visit these Microsoft Web sites:
Microsoft Certified Partners - https://partner.microsoft.com/global/30000104
Microsoft Advisory Services - http://support.microsoft.com/gp/advisoryservice
For more information about the support options that are available and about how to contact Microsoft, visit the following Microsoft Web site:http://support.microsoft.com/default.aspx?scid=fh;EN-US;CNTACTMS
Creating an ActiveX Control with an Assigned MacroTo add an ActiveX control to your worksheet and assign a macro to it, do the following:
Modifying the Control to Start the Macro When Other Events OccurYou can change the behavior of ActiveX controls such that the control starts the macro when events, other than the Click event, occur. For example, you can start the sample macro when you move the cursor over the control instead of clicking it. To do this for the control you created in the previous section, do the following:
For more information about ActiveX controls, click the Index tab in Microsoft Visual Basic Help, type the following text
Toolboxand then double-click the selected text to go to the "Toolbox" topic.
Contact us for more help
Connect with Answer Desk for expert help.