ParagraphFormat.SetListType method (Publisher)
Sets the list type of the specified ParagraphFormat object.
Syntax
expression.SetListType (Value, BulletText)
expression A variable that represents a ParagraphFormat object.
Parameters
Name | Required/Optional | Data type | Description |
---|---|---|---|
Value | Required | PbListType | Represents the list type of the specified ParagraphFormat object. Can be one of the PbListType constants declared in the Microsoft Publisher type library. |
BulletText | Optional | String | A string that represents the text of the list bullet. |
Remarks
If Value is a bulleted list and the BulletText parameter is missing, the first bullet from the Bullets and Numbering dialog box is used.
BulletText is limited to one character.
A run-time error occurs if the BulletText parameter is provided and the Value parameter is not set to pbListTypeBullet.
Example
This example tests to see if the list type is a numbered list, specifically pbListTypeArabic. If the ListType property is set to pbListTypeArabic, the ListNumberSeparator property is set to pbListSeparatorParenthesis. Otherwise, the SetListType method is called and passes pbListTypeArabic as the Value parameter, and then the ListNumberSeparator property can be set.
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
This example demonstrates how an organized document structure containing named text frames with lists can be configured. This example assumes that the publication has a naming convention for TextFrame objects containing lists that use the word "list" as a prefix. This example uses nested collection iterations to access each of the TextFrame objects in each Shapes collection of each Page. The ParagraphFormat object of each TextFrame name with the prefix "list" has the ListType and ListBulletFontSize properties set.
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
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.