XL5: Can't Delete Style Name That Ends with a Space CharacterLast reviewed: September 12, 1996Article ID: Q126089 |
The information in this article applies to:
SYMPTOMSIn Microsoft Excel, if you use a Visual Basic procedure to create a style with a name that ends with a space character, such as "test ", you cannot delete this style. When you select the style in the Style dialog box, the Delete button is unavailable (dimmed). If you run the following Visual Basic procedure to delete the style
Sub DeleteStyle() ActiveWorkbook.Styles("test ").Delete End Subyou do not receive an error message, but the style is not deleted.
CAUSEThis behavior occurs because when you use a Visual Basic procedure to create a new style, it is possible to add a style with a name that ends in a space character. This behavior is incorrect, and results in a style that you cannot delete. When you enter a style with a name that ends with a space using the Style dialog box, the space is automatically removed from the style name when you choose Add. If you use the DEFINE.STYLE() function in an MS Excel 4.0 macro to add a style with a name that contains a space, the space is also automatically removed when the style is added.
WORKAROUNDTo avoid this behavior when you create a style using a Visual Basic procedure, make sure that any style names that you add do not end with a space character.
STATUSMicrosoft has confirmed this to be a problem in the Microsoft products listed at the beginning of this article. This problem was corrected in Microsoft Excel version 5.0c. In Microsoft Excel version 5.0c, when you use a Visual Basic procedure to add a style, any spaces at the end of the style name are automatically removed when the style is added.
REFERENCESFor more information about Creating And Deleting A Style, choose the Search button in Help and type:
styles |
KBCategory: kbother
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |