Style.LinkToListTemplate method (Word)
Links the specified style to a list template so that the style's formatting can be applied to lists.
Syntax
expression. LinkToListTemplate
( _ListTemplate_
, _ListLevelNumber_
)
expression Required. A variable that represents a 'Style' object.
Parameters
Name | Required/Optional | Data type | Description |
---|---|---|---|
ListTemplate | Required | ListTemplate object | The list template that the style is to be linked to. |
ListLevelNumber | Optional | Variant | An integer corresponding to the list level that the style is to be linked to. If this argument is omitted, then the level of the style is used. |
Example
This example creates a new list template and then links heading styles 1 through 9 to levels 1 through 9. The new list template is then applied to the document. Any paragraphs formatted as heading styles will assume the numbering from the list template.
Dim ltTemp As ListTemplate
Dim intLoop As Integer
Set ltTemp = _
ActiveDocument.ListTemplates.Add(OutlineNumbered:=True)
For intLoop = 1 To 9
With ltTemp.ListLevels(intLoop)
.NumberStyle = wdListNumberStyleArabic
.NumberPosition = InchesToPoints(0.25 * (intLoop - 1))
.TextPosition = InchesToPoints(0.25 * intLoop)
.NumberFormat = "%" & intLoop & "."
End With
With ActiveDocument.Styles("Heading " & intLoop)
.LinkToListTemplate ListTemplate:=ltTemp
End With
Next intLoop
ActiveDocument.Content.ListFormat.ApplyListTemplate _
ListTemplate:=ltTemp
See also
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.
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for