Share via


ListBoxItems Property [Publisher 2003 VBA Language Reference]

Returns a WebListBoxItems object that represents the items in a Web list box control.

expression.ListBoxItems

expression Required. An expression that returns one of the objects in the Applies To list.

Example

This example creates a new Web list box control and adds five new list items to it.

Sub NewListBoxItems()
    Dim intCount As Integer
    With ActiveDocument.Pages(1).Shapes.AddWebControl _
            (Type:=pbWebControlListBox, Left:=100, _
            Top:=100, Width:=150, Height:=100).WebListBox
        .MultiSelect = msoTrue
        With .ListBoxItems
            For intCount = 1 To .Count
                .Delete (1)
            Next
            .AddItem Item:="Yellow"
            .AddItem Item:="Red"
            .AddItem Item:="Blue"
            .AddItem Item:="Green"
            .AddItem Item:="Black"
        End With
    End With
End Sub

Applies to | WebListBox Object