XL97: Using "Checked", "Gray", and "Unchecked" in Macros

Last reviewed: February 27, 1998
Article ID: Q157755
The information in this article applies to:
  • Microsoft Excel 97 for Windows

SYMPTOMS

In Microsoft Excel 97, when you run a Visual Basic for Applications macro, you may receive the following error message:

   Compile error:
   Invalid Qualifier

CAUSE

This problem will occur if the following conditions are both true:

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

        -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

You can avoid this problem by performing either of the following:

  • 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 "[<controlname>]" 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".

STATUS

This behavior is by design of Microsoft Excel 97.

MORE INFORMATION

In earlier versions of Microsoft Excel, the words "Checked", "Gray", and "Unchecked" have no special meaning. However, in Microsoft Excel 97, 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 97. Use either of the workarounds shown above to eliminate this problem.


Additional query words: XL97 8.00
Keywords : kbcode kberrmsg kbprg xlvbainfo xl97vbmigrate
Version : WINDOWS:97
Platform : WINDOWS


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: February 27, 1998
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.