Publisher) (ParagraphFormat.SetListType 方法
設定指定之 ParagraphFormat 物件的清單類型。
語法
運算式。SetListType (Value、 BulletText)
表達 代表 ParagraphFormat 物件的 變數。
參數
名稱 | 必要/選用 | 資料類型 | 描述 |
---|---|---|---|
值 | 必要 | PbListType | 代表所指定 ParagraphFormat 物件的清單類型。 可以是 Microsoft Publisher 類型程式庫中所宣告的 PbListType 常數之一。 |
BulletText | 選用 | 字串 | 字串,表示清單專案符號的文字。 |
註解
如果 Value 是項目符號清單,而且缺少 BulletText 參數,則會使用 [ 專案符號和編號 ] 對話方塊中的第一個專案符號。
BulletText 限制為一個字元。
如果提供 BulletText 參數,而且 Value 參數未設定為 pbListTypeBullet,就會發生執行階段錯誤。
範例
本範例測試以查看清單類型是否編號的清單,特別是 為 pbListTypeArabic 。 如果 ListType 屬性設定為 pbListTypeArabic, ListNumberSeparator 屬性會設定為 pbListSeparatorParenthesis。 否則, 會呼叫 SetListType 方法並傳遞 pbListTypeArabic 做為 Value 參數,然後可以設定 ListNumberSeparator 屬性。
Dim objParaForm As ParagraphFormat
Set objParaForm = ActiveDocument.Pages(1).Shapes(1).TextFrame.TextRange.ParagraphFormat
With objParaForm
If .ListType = pbListTypeArabic Then
.ListNumberSeparator = pbListSeparatorParenthesis
Else
.SetListType pbListTypeArabic
.ListNumberSeparator = pbListSeparatorParenthesis
End If
End With
本範例會示範如何可以設定含有具有清單的已命名的文字圖文框組織性的文件結構。 本範例假設出版物具有 TextFrame 物件的命名慣例,其中包含使用 「list」 這個字做為前置詞的清單。 此範例會使用存取每個 頁面上 的每個 Shapes 集合中的 TextFrame 物件的每一個巢狀的集合反覆運算次數。 具有前置詞 「list」 之每個TextFrame名稱的ParagraphFormat物件都會設定ListType和ListBulletFontSize屬性。
Dim objPage As page
Dim objShp As Shape
Dim objTxtFrm As TextFrame
'Iterate through all pages of th ePublication
For Each objPage In ActiveDocument.Pages
'Iterate through the Shapes collection of objPage
For Each objShp In objPage.Shapes
'Find each TextFrame object
If objShp.Type = pbTextFrame Then
'If the name of the TextFrame begins with "list"
If InStr(1, objShp.Name, "list") <> 0 Then
Set objTxtFrm = objShp.TextFrame
With objTxtFrm
With .TextRange
With .ParagraphFormat
.SetListType pbListTypeBullet, "*"
.ListBulletFontSize = 24
End With
End With
End With
End If
End If
Next
Next
支援和意見反應
有關於 Office VBA 或這份文件的問題或意見反應嗎? 如需取得支援服務並提供意見反應的相關指導,請參閱 Office VBA 支援與意見反應。