|
|
|
date: Mon, 29 Sep 2008 05:59:58 -0700 (PDT),
group: microsoft.public.word.vba.general
back
Re: Outline List Template numbering changes with another computer
Actually, I thought it worked for me, but I am finding several
glitches. The code below is fired when the code for my OK button
reaches this particular step.
Here are several things that go wrong when I run the template (and
they appear to be different things than those my colleague
experiences):
1. My Heading1 paragraph takes on the format of Heading 2. (The
Heading1 style is still ok and I was able to re-Style the text.
2. Heading2 and Heading3 are ok.
3. Listlevel 4 was linked to my ListNumber (so it would restart after
Heading2), but when I produce a document, ListLevel 4 is unlinked and
is back to it's outline numbering ways (eg." 4.1.1.1" when it is just
supposed to be "1.") Is my code restarting the ListTemplate
someway---
Ahhh, it is dawning on me that I need to reset every item in the List
Template when I run the macro not just the Heading 1. I will try
rewriting my code and testing that. Meanwhile, if anyone has any other
suggestions, I would be most pleased to hear them--especially why
Heading1 text won't format with the Heading1 style.
Public Sub UpdateHeading1()
'
Dim rngHead1 As Range
Set rngHead1 = ActiveDocument.Bookmarks("bHead1").Range
If ActiveDocument.Bookmarks.Exists("bHead1") = False Then 'If it
doesn't exist
'Add the bookmark to the first heading 1
'Find which paragraph has a heading 1
With ActiveDocument.Content.Find 'Find the page break
.ClearFormatting
.Style = wdStyleHeading1
.text = ""
.Execute
If .Found = True Then
.Parent.Select
Selection.Range.Bookmarks.Add Name:="bHead1"
End If
End With
'
Else
End If
With
ListGalleries(wdOutlineNumberGallery).ListTemplates(1).ListLevels(1)
.NumberFormat = "%1"
.TrailingCharacter = wdTrailingTab
.NumberStyle = wdListNumberStyleArabic
.NumberPosition = InchesToPoints(0)
.Alignment = wdListLevelAlignLeft
.StartAt = strSecNum
.LinkedStyle = "Heading 1"
End With
ListGalleries(wdOutlineNumberGallery).ListTemplates(1).Name =
"D&C"
ActiveDocument.Styles("Heading 1").LinkToListTemplate
ListTemplate:= _
ListGalleries(wdOutlineNumberGallery).ListTemplates(1),
ListLevelNumber:= _
1
With ActiveDocument.Styles("Heading 1")
.AutomaticallyUpdate = False
.BaseStyle = ""
.NextParagraphStyle = "Body Text"
End With
rngHead1.text = strSectionTitle
rngHead1.Select
'Reinsert the bookmark
ActiveDocument.Bookmarks.Add "bHead1", rngHead1
End Sub
date: Mon, 29 Sep 2008 07:00:06 -0700 (PDT)
author: MLBeck
|
|