XL5: Problems with MultiSelect Property of ListBox Class

Last reviewed: September 12, 1996
Article ID: Q115620
The information in this article applies to:
  • Microsoft Excel for Windows, version 5.0

SYMPTOMS

In Microsoft Excel version 5.0, when you use the MultiSelect property for ListBox objects in a Visual Basic, Applications Edition, macro, you may experience either of the following problems:

  • You receive the error message:

    Run-time error '1005': Unable to set the MultiSelect property of the ListBox class

    -or-

  • The MultiSelect property that is actually defined for the list box is not the one you expected.

CAUSE

The Microsoft Excel version 5.0 constants xlNone, xlSimple, and xlExtended are mapped to the wrong values.

WORKAROUND

For the MultiSelect property, use the values 1, 2, and 3 in place of the constants xlNone, xlSimple, and xlExtended (respectively).

   To set the selection mode
   of a list box to this          Use this value
   -----------------------------------------------------

   Single select                  <object>.Multiselect = 1
   Simple multi-select            <object>.MultiSelect = 2
   Extended multi-select          <object>.MultiSelect = 3

STATUS

Microsoft has confirmed this to be a problem in Microsoft Excel version 5.0 for Windows. This problem was corrected in Microsoft Excel for Windows, version 5.0c.

MORE INFORMATION

For more information about the expected behavior of these constants, choose the search button in Visual Basic Help, and type:

   Multiselect

The following sections describe the ACTUAL behavior of each constant.

<object>.MultiSelect = xlNone

This command will produce the following error message:

   Run-time error '1005':
   Unable to set the MultiSelect property of the ListBox class

<object>.MultiSelect = xlSimple

This command will cause the list box to behave as if it had the Single select (xlNone) property.

<object>.MultiSelect = xlExtended

This command will cause the list box to behave as if it had the Simple multi-select (xlSimple) property .

-also-

The help topic for the MultiSelect property in VBA_XL.HLP provides the example

   ActiveSheet.ListBoxes(1).MultiSelect = True

and implies that this command will give the list box the Extended multi-select (xlExtended) property. However, the actual behavior for this property is as follows:
  • <object>.Multiselect = True: This command will cause the list box to behave as if it had the Single select (xlNone) property.
  • <object>.Multiselect = False: This command will produce the error message:

          Run-time error '1005':
          Unable to set the MultiSelect property of the ListBox class
    


KBCategory: kbusage
KBSubcategory:

Additional reference words: 5.00



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