Shape.WebListBox property (Publisher)

Returns the WebListBox object associated with the specified shape.

Syntax

expression.WebListBox

expression A variable that represents a Shape object.

Return value

WebListBox

Example

This example creates a new web list box and adds several items to it. Note that when initially created, a web list box control contains three default items. This example includes a loop that deletes the default list box items before adding new items.

Dim shpNew As Shape 
Dim wlbTemp As WebListBox 
Dim intCount As Integer 
 
Set shpNew = ActiveDocument.Pages(1).Shapes _ 
 .AddWebControl(Type:=pbWebControlListBox, Left:=100, _ 
 Top:=150, Width:=300, Height:=72) 
 
Set wlbTemp = shpNew.Web ListBox 
 
With wlbTemp 
 .MultiSelect = msoFalse 
 
 With .ListBoxItems 
 For intCount = 1 To .Count 
 .Delete (1) 
 Next intCount 
 
 .AddItem Item:="Green" 
 .AddItem Item:="Purple" 
 .AddItem Item:="Red" 
 .AddItem Item:="Black" 
 End With 
End With

Support and feedback

Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.