Compartir a través de


Método ParagraphFormat.SetListType (Publisher)

Establece el tipo de lista del objeto ParagraphFormat especificado.

Sintaxis

expresión. SetListType (Value, BulletText)

expresión Variable que representa un objeto ParagraphFormat .

Parameters

Nombre Obligatorio/opcional Tipo de datos Descripción
Valor Obligatorio PbListType Representa el tipo de lista del objeto ParagraphFormat especificado. Puede ser una de las constantes PbListType declaradas en la biblioteca de tipos de Microsoft Publisher.
BulletText Opcional String Cadena que representa el texto de la viñeta de lista.

Observaciones

Si Value es una lista con viñetas y falta el parámetro BulletText , se usa la primera viñeta del cuadro de diálogo Viñetas y numeración .

BulletText está limitado a un carácter.

Se produce un error en tiempo de ejecución si se proporciona el parámetro BulletText y el parámetro Value no está establecido en pbListTypeBullet.

Ejemplo

En este ejemplo se comprueba si el tipo de lista es una lista numerada, específicamente pbListTypeArabic. Si la propiedad ListType se establece en pbListTypeArabic, la propiedad ListNumberSeparator se establece en pbListSeparatorParenthesis. De lo contrario, se llama al método SetListType y pasa pbListTypeArabic como parámetro Value y, a continuación, se puede establecer la propiedad 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 
 

En este ejemplo se muestra cómo se puede configurar una estructura de documento organizada que contiene marcos de texto con nombre con las listas. En este ejemplo se supone que la publicación tiene una convención de nomenclatura para objetos TextFrame que contienen listas que usan la palabra "list" como prefijo. En este ejemplo se utilizan iteraciones de colecciones anidadas para tener acceso a cada uno de los objetos TextFrame de cada colección Shapes de cada página. El objeto ParagraphFormat de cada nombre textframe con el prefijo "list" tiene las propiedades ListType y ListBulletFontSize establecidas.

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 
 

Soporte técnico y comentarios

¿Tiene preguntas o comentarios sobre VBA para Office o esta documentación? Vea Soporte técnico y comentarios sobre VBA para Office para obtener ayuda sobre las formas en las que puede recibir soporte técnico y enviar comentarios.