J
JSM
Hi,
After looking through these newsgroups I thought I had come across the
solution to copying styles with outline numbering from one document to
another, however I have come across a problem.
I have styles called Numbered Body Text Level 1 / 2 / 3 which are
based on the styles Numbered Heading Level 1 / 2 / 3 (this is so I can
use different formatting but keep the numbering flowing). The Numbered
Heading Level styles are set up with outline numbering. I have written
a macro which copies the styles to the active document then creates
the list templates accordingly. This works perfectly if none of these
styles are in the target file to begin with.
The problem is, if the document already contains the text formatted
with Numbered Body Text Level 1 / 2 / 3 styles, then the style for
that text is switched to Numbered Headling Level x as soon as I
specify the Linked Style for the list template level.
Any ideas how I can stop this happening? I am working with Word 2000
SP1. I can send the template containing the styles if it helps.
Cheers,
John
Code as follows:
*******************************
Dim aListTemplate As ListTemplate, Exists As Boolean
ActiveDocument.CopyStylesFromTemplate "c:\styles.dot"
For Each aListTemplate In ActiveDocument.ListTemplates
If aListTemplate.Name = "NumHeadings" Then
Exists = True
Exit For
End If
Next
If Not Exists Then ActiveDocument.ListTemplates.Add True,
"NumHeadings"
With ActiveDocument.ListTemplates("NumHeadings").ListLevels(1)
.NumberFormat = "%1."
.NumberStyle = wdListNumberStyleArabic
.NumberPosition = CentimetersToPoints(0)
.Alignment = wdListLevelAlignLeft
.TextPosition = CentimetersToPoints(1.5)
.TrailingCharacter = wdTrailingTab
.TabPosition = CentimetersToPoints(1.5)
.ResetOnHigher = True
.StartAt = 1
.LinkedStyle = "Numbered Heading Level 1"
End With
With ActiveDocument.ListTemplates("NumHeadings").ListLevels(2)
.NumberFormat = "%1.%2"
.NumberStyle = wdListNumberStyleArabic
.NumberPosition = CentimetersToPoints(0)
.Alignment = wdListLevelAlignLeft
.TextPosition = CentimetersToPoints(1.5)
.TrailingCharacter = wdTrailingTab
.TabPosition = CentimetersToPoints(1.5)
.ResetOnHigher = True
.LinkedStyle = "Numbered Heading Level 2"
End With
With ActiveDocument.ListTemplates("NumHeadings").ListLevels(3)
.NumberFormat = "%1.%2.%3"
.NumberStyle = wdListNumberStyleArabic
.NumberPosition = CentimetersToPoints(1.5)
.Alignment = wdListLevelAlignLeft
.TextPosition = CentimetersToPoints(3)
.TrailingCharacter = wdTrailingTab
.TabPosition = CentimetersToPoints(3)
.ResetOnHigher = True
.LinkedStyle = "Numbered Heading Level 3"
End With
After looking through these newsgroups I thought I had come across the
solution to copying styles with outline numbering from one document to
another, however I have come across a problem.
I have styles called Numbered Body Text Level 1 / 2 / 3 which are
based on the styles Numbered Heading Level 1 / 2 / 3 (this is so I can
use different formatting but keep the numbering flowing). The Numbered
Heading Level styles are set up with outline numbering. I have written
a macro which copies the styles to the active document then creates
the list templates accordingly. This works perfectly if none of these
styles are in the target file to begin with.
The problem is, if the document already contains the text formatted
with Numbered Body Text Level 1 / 2 / 3 styles, then the style for
that text is switched to Numbered Headling Level x as soon as I
specify the Linked Style for the list template level.
Any ideas how I can stop this happening? I am working with Word 2000
SP1. I can send the template containing the styles if it helps.
Cheers,
John
Code as follows:
*******************************
Dim aListTemplate As ListTemplate, Exists As Boolean
ActiveDocument.CopyStylesFromTemplate "c:\styles.dot"
For Each aListTemplate In ActiveDocument.ListTemplates
If aListTemplate.Name = "NumHeadings" Then
Exists = True
Exit For
End If
Next
If Not Exists Then ActiveDocument.ListTemplates.Add True,
"NumHeadings"
With ActiveDocument.ListTemplates("NumHeadings").ListLevels(1)
.NumberFormat = "%1."
.NumberStyle = wdListNumberStyleArabic
.NumberPosition = CentimetersToPoints(0)
.Alignment = wdListLevelAlignLeft
.TextPosition = CentimetersToPoints(1.5)
.TrailingCharacter = wdTrailingTab
.TabPosition = CentimetersToPoints(1.5)
.ResetOnHigher = True
.StartAt = 1
.LinkedStyle = "Numbered Heading Level 1"
End With
With ActiveDocument.ListTemplates("NumHeadings").ListLevels(2)
.NumberFormat = "%1.%2"
.NumberStyle = wdListNumberStyleArabic
.NumberPosition = CentimetersToPoints(0)
.Alignment = wdListLevelAlignLeft
.TextPosition = CentimetersToPoints(1.5)
.TrailingCharacter = wdTrailingTab
.TabPosition = CentimetersToPoints(1.5)
.ResetOnHigher = True
.LinkedStyle = "Numbered Heading Level 2"
End With
With ActiveDocument.ListTemplates("NumHeadings").ListLevels(3)
.NumberFormat = "%1.%2.%3"
.NumberStyle = wdListNumberStyleArabic
.NumberPosition = CentimetersToPoints(1.5)
.Alignment = wdListLevelAlignLeft
.TextPosition = CentimetersToPoints(3)
.TrailingCharacter = wdTrailingTab
.TabPosition = CentimetersToPoints(3)
.ResetOnHigher = True
.LinkedStyle = "Numbered Heading Level 3"
End With