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.


KBCategory: kbtool
KBSubcategory:

Additional reference words: 5.00 5.00a 5.00c 7.00 7.00a



THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: September 13, 1996
©1997 Microsoft Corporation. All rights reserved. Legal Notices.