Microsoft Knowledge Base |
|
XL5: Changing State of Control Is Not Recorded |
|
|
Last reviewed: March 27, 1997
Article ID: Q110501 |
|
5.00 7.00 | 5.00
WINDOWS MACINTOSHkbusage The information in this article applies to:
SYMPTOMSIn Microsoft Excel, if you run the Macro Recorder and change the state of a control either on a worksheet or in a custom dialog box by selecting the control, this change is not recorded in your macro.
CAUSEThis behavior is by design because you do not always want to record the change of the state of a control when you are recording a macro. For example, you may want to record an event macro that will perform an action regardless of the value of the control.
WORKAROUNDTo change the state of a control on a worksheet or in a custom dialog box, use either of the procedures below.
Set Initial State of ControlTo set the initial state of a button or check box control, do the following:
Change State of Control Within a MacroTo change the state of a control within a macro, use a command to change the Value property of the control. The available values for each control vary with the control. For information about the Value properties of each control, choose the Search button in the Visual Basic Reference and type the following:
Value Property MORE INFORMATIONIf you have assigned a procedure to the selection of a control, the procedure is recorded when you select that control while the macro recorder is running. For example, if you assign the procedure Check_Box_Selected to a check box on your worksheet, the following code is written when you run the Macro Recorder and select the check box
Application.Run Macro:="Book1!Check_Box_Selected"(where BOOK1 is the name of the workbook containing the procedure that Check_Box_Selected). Use the Assign Macro command on the Tools menu to assign a macro to the selected control.
REFERENCES"Visual Basic User's Guide," pages 219-239 For more Tips For Working With Graphic Objects or Information On Controls, choose the Search button in Help and type:
controls |
|
KBCategory: kbusage
©1997 Microsoft Corporation. All rights reserved. Legal Notices. |