XL5: Custom Multiple Select List Box Returns Incorrect Result

ID: Q112067

5.00 5.00c 7.00 WINDOWS kbusage

The information in this article applies to:

SYMPTOMS

In Microsoft Excel, if you run a macro that displays a custom dialog box with a multiple selection list box that was created in Microsoft Excel version 3.0 or 4.0, when you select an item or items in the list box and choose OK, the result returned for the item selected in the list box is incorrect.

CAUSE

When you select an item from a multiple selection list box in a custom dialog box, a name is created on the sheet that contains the dialog box definition table. This name stores the number or numbers that correspond to the items that you select in the list box. The values are stored as an array, and the name created to store these values is the name that you define in the custom dialog box definition table. To specify the name of this result, type the name in the Init/Result column of the list box line (item number 15) in the dialog box definition table.

When the dialog box definition table is not contained on the macro sheet with the macro that runs it, and you open the files that contain the dialog definition and the macro that runs the dialog box in Microsoft Excel version 5.x or 7.0, when you run the dialog box, the name created to store the values you select is created as a local name, but the values returned by the macro are those contained in the global name. The values returned are the values that you selected in the list box the last time you ran the dialog box.

WORKAROUND

To avoid having incorrect results returned when you run a macro that displays a custom dialog box with a multiple selection list box that was created in Microsoft Excel versions 3.0 or 4.0, do either of the following:

KBCategory: kbusage KBSubcategory:

Additional reference words: 5.00 5.00c 7.00

Version           : 5.00 5.00c 7.00
Platform          : WINDOWS

Last Reviewed: March 29, 1997