共用方式為


Shape.WebListBox 屬性 (Publisher)

會傳回與指定圖案相關的 WebListBox 物件。

語法

運算式WebListBox

表達 代表 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 支援與意見反應