Creating the Dialog BoxTo create the dialog box, follow these steps:
- In a new workbook, on the Insert menu, click Macro, and then Dialog.
- On the Forms toolbar, click the Option Button button. The mouse pointer will change to a cross. Center the pointer one-half inch below the bottom of Dialog1. Press and hold down the left mouse button and drag down a quarter of an inch and over one-and-a-half inches. Release the mouse button. There should now be an option button below Dialog1.
- On the Forms toolbar click the Create Button button. Inside of Dialog1, center the pointer one-and-a-half inches from the bottom and one and a half inches from the right side of the dialog box. Drag down three-quarters of an inch and over to the right three-quarters of an inch. Release the mouse button. There should now be a rectangular button on Dialog1.
Creating the CodeTo create the code, follow these steps:
- On the Insert menu, click Macro, and then Module.
- Type the following code:
DialogSheets(1).DialogFrame.Height = 147
DialogSheets(1).DialogFrame.Height = 200
Attaching the Expand Procedure to the Dialog ButtonTo attach the Expand procedure to the dialog button, follow these steps:
- Activate the Dialog1 sheet by clicking its sheet tab.
- Center the mouse pointer over the top of the button that you created in the bottom-right corner of Dialog1. Click once with the right mouse button. Click Assign Macro on the shortcut menu, and from the list of available macros, select Expand. Click OK.
Running the MacroTo run the macro, follow these steps:
- Activate a worksheet within the workbook. On the Forms toolbar, click the Create Button button and create a button on the current worksheet. The Assign Macro dialog box will appear. Select Show_Dialog, and then click OK.
- Click with the left mouse button once in a blank area of the current worksheet.
- Click with the left mouse button once on the button to run the macro.
- When the dialog box appears, click with the left mouse button once on the button that you created to show the option button. Click OK to dismiss the dialog box.
For more information about dialog boxes in Microsoft Excel version 7.0, click Answer Wizard on the Help menu and type:
For more information about dialog boxes in Microsoft Excel version 5.0, click the Search button in Help and type:
Id. de artículo: 151343 - Última revisión: 11 oct. 2006 - Revisión: 1