GetCustomListContents Method

Applies To

Application Object.

Description

Returns a custom list (an array of strings) for a specified list number.

Syntax

object.GetCustomListContents(listNum)

object

Required. The Application object.

listNum

Required. The list number.

See Also

AddCustomList Method, CustomListCount Property, DeleteCustomList Method, GetCustomListNum Method.

Example

This example writes the elements of the first custom list in column one on Sheet1.


Sub foo()
On Error GoTo err_handler
listArray = Application.GetCustomListContents(1)
For i = LBound(listArray, 1) To UBound(listArray, 1)
    Worksheets("sheet1").Cells(i, 1).Value = listArray(i)
Next i
Exit Sub

err_handler:
    MsgBox "Custom list does not exist"
End Sub