Microsoft KB Archive/213573

= XL2000: "Compile error: Invalid Qualifier" Using "Checked", "Gray", and "Unchecked" in Macros =

Article ID: 213573

Article Last Modified on 9/12/2006

-

APPLIES TO


 * Microsoft Excel 2000 Standard Edition

-



This article was previously published under Q213573





SYMPTOMS
When you run a Visual Basic for Applications macro, you may receive the following error message:

Compile error:

Invalid Qualifier



CAUSE
This problem occurs if the following conditions are true:

 You have controls in a custom dialog box named "Checked", "Gray", or "Unchecked" (without quotation marks).

-and-

  In your macro, you enclose the name of one of the controls in brackets when referring to it, for example: [Checked].Value = xlOn 

NOTE: This problem does not apply to controls named "Grey".



WORKAROUND
To work around this problem, use either of the following methods:

 Rename your controls so that none of them are named "Checked", "Gray", or "Unchecked". If you do this, you will also need to modify your Visual Basic macro code so that it refers to controls by their new names.

-or-

  Within your macros, replace all occurrences of "[ ]" with a proper reference to the specified control. For example, if your macro contains the following line of code [Unchecked].Value = xlOff and "Unchecked" is the name of a check box within your custom dialog box, change the line to read: ActiveDialog.Checkboxes("Unchecked").Value = xlOff If you do this throughout your macro code, you can still use controls named "Checked", "Gray", and "Unchecked". </ul>

<div class="moreinformation_section">

MORE INFORMATION
In versions of Microsoft Excel earlier than Excel 97, the words "Checked", "Gray", and "Unchecked" have no special meaning. However, in Microsoft Excel 2000, these three words are global constants belonging to the Stdole Type Library.

Because of this, it is not possible to refer to these constants by enclosing them in brackets when running a macro in Microsoft Excel 2000.

Additional query words: XL2000

Keywords: kberrmsg kbprogramming kbprb kbdtacode KB213573

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.