通过


Shape.WebListBox 属性 (Publisher)

返回与指定形状关联的 WebListBox 对象。

语法

表达式WebListBox

expression 一个代表 Shape 对象的变量。

返回值

WebListBox

示例

本示例创建一个新的 Web 列表框,并向其中添加多个项。 请注意,最初创建时,Web 列表框控件包含三个默认项。 本示例包含一个循环,用于在添加新项目之前删除默认的列表框项目。

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

支持和反馈

有关于 Office VBA 或本文档的疑问或反馈? 请参阅 Office VBA 支持和反馈,获取有关如何接收支持和提供反馈的指南。