The information in this article applies to:
- Microsoft Excel for Windows, version 5.0, 5.0c
- Microsoft Excel for Windows 95, version 7.0
- Microsoft Excel for the Power Macintosh, versions 5.0, 5.0a
- Microsoft Excel for the Macintosh, versions 5.0, 5.0a
SUMMARY
In Microsoft Excel, button controls on a dialog sheet cannot be
directly edited to change font properties such as font name, style,
alignment, or size. However, you can indirectly modify the appearance of
the button by pasting a "picture" on top of the button.
MORE INFORMATION
Customizing the Button Appearance
To customize the button appearance on a dialog sheet, follow these steps:
- On the File menu, click New to create a new workbook.
- On the Insert menu, click Macro, and then click Dialog Sheet.
- Click the Create Button button, and draw a button on the Dialog
sheet.
- Erase the button's caption by selecting the text on the button and
pressing the DEL key.
- Select a worksheet in the new workbook.
- In cell A1, type the following "Excel 5.0 is too cool!" (without the
quotation marks).
- Select cell A1. On the Format menu, click Cells.
- Click the Font tab and select the following options:
- For Font, select Times New Roman
- For Size, select 8
- For Style, select Italic.
- Click the Alignment tab, select the Wrap Text check box, and click
OK.
- Press the SHIFT key, click Copy Picture on the Edit menu, and click
OK.
- Select the dialog sheet.
- On the Edit menu, click Paste.
- Drag the pasted picture over the top of the button.
- Select the picture. On the Format menu, click Object.
- Click the Patterns tab, and select the following options, and click
OK:
- For Fill, select None
- For Border, select none
Giving the Effect of Multiple Lines of Text
To add a button and group it with a text box to give the effect of multiple
lines of formatted text, follow these steps:
- On a module sheet, enter the following code:
Sub HideDialog()
ActiveDialog.Hide
End Sub
- On a dialog sheet, create a button. Make it about 1.5 inches square.
Clear the button text.
- Use the Text button on the Drawing toolbar to create a text box on top
of the button. Line up its edges such that they are just inside of the
button's edges.
- In the text box, type "Hide" and press RETURN. Then, type "the Dialog
Box" so that there are two lines of text in the text box.
- Click the dialog box background to clear the text mode of the text box,
and then click the text box again so its borders are highlighted.
- On the Format menu click Object, and set the following attributes for
the text:
a. Click the Patterns tab and click None under both Border and Fill.
b. Click the Font tab. Click Times New Roman in the Font box, click
Bold Italic in the Font Style box, click 18 in the Size box, and
then click a color in the color box.
c. Click the Alignment tab. Click Center in both the Horizontal and
Vertical Text Alignment boxes. Click OK.
- Press the SHIFT key and click the edge of the button so that both the
text box and button are both selected. On the Format menu, point to
Placement, and click Group.
- With the button selected, click Assign Macro on the Tools menu. Click
the HideDialog macro and click OK.
- Show the dialog box and click the "Hide the Dialog Box" button that you
created.
The macro hides the dialog box.
Using a Graphic on a Button
To use a graphic object on top of a button, follow these steps:
- Add a button slightly larger than the graphic object.
- Paste or move the graphic object on top of the button.
- Press the SHIFT key and click the edge of the button so that both the
graphic and the button are selected.
- Point to Placement on the Format menu and click Group.
- With the button selected, click Assign Macro on the Tools menu.
- Click the HideDialog macro and click OK.
- Display the dialog box and click the button you created.
The macro hides the dialog box.
For more information about using objects on dialog sheets, refer to Chapter
41 of the "User's Guide," version 5.0.
|