Add items to a list at run time

Microsoft Office Outlook 2003

Show All Show All

Add items to a list at run time

In a ListBox or ComboBox with a single column, use the AddItem method to add an individual entry to the list.

In a multicolumn list box or combo box, you can use the List and Column properties to load the list from a two-dimensional array, as shown in the following steps.

  1. Create a multicolumn ListBox or ComboBox control.

  2. In VBScript, create a two-dimensional array that contains the items you want to put in the list.

  3. Set the ColumnCount property of the list box or combo box to match the number of entries in the list. To set the property, click the property and enter a value in the Apply box.

  4. Do one of the following:
    • Assign the array as the value of the List property. The contents of the list box will match the contents of the array exactly.

    • Assign the array as the value of the Column property. Column transposes rows and columns, so each row of the list box matches the corresponding column of the array.