Microsoft KB Archive/117226

= Microsoft Knowledge Base =

XL: Button Width Reported as Zero for Toolbar Buttons
Last reviewed: September 13, 1996

Article ID: Q117226

The information in this article applies to:


 * Microsoft Excel for Windows 95, versions 7.0, 7.0a
 * Microsoft Excel for Windows, versions 5.0, 5.0c
 * Microsoft Excel for the Macintosh, versions 5.0, 5.0a

SUMMARY
In the versions of Microsoft Excel mentioned above, the toolbar button Width property will return a zero value if the toolbar button does not produce a drop-down or scrollable list.

This behavior is by design.

MORE INFORMATION
The only toolbar buttons that can be resized are those that include a drop- down list (such as the "Font" toolbar button) or a scrolling list box (such as the "TipWizard Box" toolbar button). Therefore, the Width property of these types of toolbar buttons will return a non-zero number. The Width property of any other type of toolbar button will return the value 0, because the button cannot be resized.

For example, if you get the Width property of the "Bold" toolbar button (the fifth button of the Formatting toolbar) by using the following line of Visual Basic code

ButtonWidth = Toolbars("Formatting").ToolbarButtons(5).Width the ButtonWidth variable will have a value of 0. You get this value because the Bold toolbar button has a fixed width.

Getting the Width property of the "Font" toolbar button (the first button of the Formatting toolbar) by using this line of code

ButtonWidth = Toolbars("Formatting").ToolbarButtons(1).Width will return a value (141, for example) to the ButtonWidth property because the "Font" toolbar button is resizable.