Microsoft KB Archive/120112

= Microsoft Knowledge Base =

XL5: CommandUnderlines Property Incorrectly Set to xlOff
Last reviewed: September 13, 1996

Article ID: Q120112

The information in this article applies to:


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

SYMPTOMS
In Microsoft Excel, when you use a Visual Basic procedure to set the value of the CommandUnderlines property to xlOff, and you then read the value of the property, the value returned is xlOff, instead of xlOn. This behavior contradicts the help topic for the CommandUnderlines property in the Visual Basic Reference that indicates that the CommandUnderlines property always returns xlOn.

CAUSE
This behavior occurs when you run a procedure such as the following to set and then return the CommandUnderlines property:

Sub Test Application.CommandUnderlines = xlOff MsgBox Application.CommandUnderlines End Sub When you run this procedure in Microsoft Excel version 5.0, a dialog box appears with the value -4146, the value of the Microsoft Excel constant xlOff, instead of the value 1 for the constant xlOn as expected.

In Microsoft Excel versions 5.0c and 7.0, the value displayed is -4105, the value of the Microsoft Excel constant xlAutomatic.

STATUS
Microsoft has confirmed this to be a problem in the versions of Microsoft Excel listed at the beginning of this article.

MORE INFORMATION
The CommandUnderlines property returns or sets the state of the command underlines in Microsoft Excel 5.0 for the Macintosh. If you set the property to the value xlOn, command underlines are turned on. The Visual Basic reference states that in Microsoft Excel for Windows, reading this property always returns xlOn, and setting this property to anything but xlOn is an error. However, you do not receive an error when you set this property to a value of xlOff.