J
Jason Logue
Hi, I posted this to the vba programming list, but I thought I should
post it to the vba for beginners site as well since I qualify myself
as a beginner. I am working on a macro that finds each instance of a
Heading 6, then
moves one line below that text to the formatted numbered list and sets
the
numbered list to start at one. I am still new at this, so I am trying
to
keep it simple (i.e. I am not sure how to tell it to look only for
lists that
begin with 2,3,4,5, etc, but not 1). I want the code to repeat until
all the
numbered lists following heading sixes are restarted. Here is the
code I
have thus far (as you can probably tell, it's not working):
Const LookFor As String = "Recommendations:"
'
With ActiveDocument.Content.Find
.ClearFormatting
.Text = LookFor
With .Style = ActiveDocument.Styles("Heading 6")
End With
Do While .Execute
Selection.MoveDown Unit:=wdLine, Count:=1
With ListGalleries(wdOutlineNumberGallery).ListTemplates(4).ListLevels(1)
.NumberFormat = "%1."
.TrailingCharacter = wdTrailingTab
.NumberStyle = wdListNumberStyleArabic
.NumberPosition = InchesToPoints(0)
.Alignment = wdListLevelAlignLeft
.TextPosition = InchesToPoints(0)
.TabPosition = InchesToPoints(0#)
.ResetOnHigher = 0
.StartAt = 1
.LinkedStyle = "List Number"
End With
Loop
TIA - Jason
post it to the vba for beginners site as well since I qualify myself
as a beginner. I am working on a macro that finds each instance of a
Heading 6, then
moves one line below that text to the formatted numbered list and sets
the
numbered list to start at one. I am still new at this, so I am trying
to
keep it simple (i.e. I am not sure how to tell it to look only for
lists that
begin with 2,3,4,5, etc, but not 1). I want the code to repeat until
all the
numbered lists following heading sixes are restarted. Here is the
code I
have thus far (as you can probably tell, it's not working):
Const LookFor As String = "Recommendations:"
'
With ActiveDocument.Content.Find
.ClearFormatting
.Text = LookFor
With .Style = ActiveDocument.Styles("Heading 6")
End With
Do While .Execute
Selection.MoveDown Unit:=wdLine, Count:=1
With ListGalleries(wdOutlineNumberGallery).ListTemplates(4).ListLevels(1)
.NumberFormat = "%1."
.TrailingCharacter = wdTrailingTab
.NumberStyle = wdListNumberStyleArabic
.NumberPosition = InchesToPoints(0)
.Alignment = wdListLevelAlignLeft
.TextPosition = InchesToPoints(0)
.TabPosition = InchesToPoints(0#)
.ResetOnHigher = 0
.StartAt = 1
.LinkedStyle = "List Number"
End With
Loop
TIA - Jason