SetListType Method

Microsoft Publisher Visual Basic

Show All Show All

SetListType Method

Sets the list type of the specified ParagraphFormat object.

expression.SetListType(pbListType, BulletText)

expression    Required. An expression that returns a ParagraphFormat object.

PbListType can be one of these PbListType constants.
pbListTypeAiueo
pbListTypeArabic
pbListTypeArabic1
pbListTypeArabic2
pbListTypeArabicLeadingZero
pbListTypeBullet
pbListTypeCardinalText
pbListTypeChiManSty
pbListTypeChinaDbNum1
pbListTypeChinaDbNum2
pbListTypeChinaDbNum3
pbListTypeChinaDbNum4
pbListTypeChosung
pbListTypeCirclenum
pbListTypeDAiueo
pbListTypeDArabic
pbListTypeDbChar
pbListTypeDbNum1
pbListTypeDbNum2
pbListTypeDbNum3
pbListTypeDbNum4
pbListTypeDIroha
pbListTypeGanada
pbListTypeGB1
pbListTypeGB2
pbListTypeGB3
pbListTypeGB4
pbListTypeHebrew1
pbListTypeHebrew2
pbListTypeHex
pbListTypeHindi1
pbListTypeHindi2
pbListTypeHindi3
pbListTypeHindi4
pbListTypeIroha
pbListTypeKoreaDbNum1
pbListTypeKoreaDbNum2
pbListTypeKoreaDbNum3
pbListTypeKoreaDbNum4
pbListTypeLowerCaseLetter
pbListTypeLowerCaseRoman
pbListTypeLowerCaseRussian
pbListTypeNone
pbListTypeOrdinal
pbListTypeOrdinalText
pbListTypeSbChar
pbListTypeTaiwanDbNum1
pbListTypeTaiwanDbNum2
pbListTypeTaiwanDbNum3
pbListTypeTaiwanDbNum4
pbListTypeThai1
pbListTypeThai2
pbListTypeThai3
pbListTypeUpperCaseLetter
pbListTypeUpperCaseRoman
pbListTypeUpperCaseRussian
pbListTypeVietnamese1
pbListTypeZodiac1
pbListTypeZodiac2
pbListTypeZodiac3

pbListType   Required pbListType that represents the list type of the specified ParagraphFormat object.

BulletText   Optional String that represents the text of the list bullet.

Remarks

If the pbListType is a bulleted list and the BulletText 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 pbListType 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 ListSeparator is set to pbListSeparatorParenthesis. Otherwise the SetListType method is called and passed pbListTypeArabic as the pbListType 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 set.

      Dim objPage As page
Dim objShp As Shape
Dim objTxtFrm As TextFrame

'iterate through all Pages of Publication
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