Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.word.formatting.longdocs
|
|||
|
|||
how do I loop this macro?
I have a macro that I use to restart lists in a document. I created
this macro by recording a macro, so it's long and bulky. What it does it search for the next occurence of the word "restartlist" and then it manually restarts the numbering there. It works, but I have to run the macro about a dozen or more times depending on the number of lists I have in my document. I would like to reduce this operation to one-click. Is there any way to tell the macro to loop until it cycles through the entire document? Here is the macro code: Sub restartlist() ' ' restartlist Macro ' Macro recorded 12/14/2006 by Tom Johnson ' Selection.Find.ClearFormatting With Selection.Find .Text = "restartlist" .Replacement.Text = "see Figure " .Forward = True .Wrap = wdFindContinue .Format = False .MatchCase = False .MatchWholeWord = False .MatchWildcards = False .MatchSoundsLike = False .MatchAllWordForms = False End With Selection.Find.Execute With ListGalleries(wdOutlineNumberGallery).ListTemplate s(5).ListLevels(1) .NumberFormat = "%1." .TrailingCharacter = wdTrailingTab .NumberStyle = wdListNumberStyleArabic .NumberPosition = InchesToPoints(1) .Alignment = wdListLevelAlignLeft .TextPosition = InchesToPoints(1.25) .TabPosition = InchesToPoints(0) .ResetOnHigher = 0 .StartAt = 1 With .Font .Bold = wdUndefined .Italic = wdUndefined .StrikeThrough = wdUndefined .Subscript = wdUndefined .Superscript = wdUndefined .Shadow = wdUndefined .Outline = wdUndefined .Emboss = wdUndefined .Engrave = wdUndefined .AllCaps = wdUndefined .Hidden = wdUndefined .Underline = wdUndefined .Color = wdUndefined .Size = wdUndefined .Animation = wdUndefined .DoubleStrikeThrough = wdUndefined .Name = "" End With .LinkedStyle = "ListNumbered" End With With ListGalleries(wdOutlineNumberGallery).ListTemplate s(5).ListLevels(2) .NumberFormat = "%2." .TrailingCharacter = wdTrailingTab .NumberStyle = wdListNumberStyleLowercaseLetter .NumberPosition = InchesToPoints(1.25) .Alignment = wdListLevelAlignLeft .TextPosition = InchesToPoints(1.5) .TabPosition = InchesToPoints(0) .ResetOnHigher = 1 .StartAt = 1 With .Font .Bold = wdUndefined .Italic = wdUndefined .StrikeThrough = wdUndefined .Subscript = wdUndefined .Superscript = wdUndefined .Shadow = wdUndefined .Outline = wdUndefined .Emboss = wdUndefined .Engrave = wdUndefined .AllCaps = wdUndefined .Hidden = wdUndefined .Underline = wdUndefined .Color = wdUndefined .Size = wdUndefined .Animation = wdUndefined .DoubleStrikeThrough = wdUndefined .Name = "" End With .LinkedStyle = "" End With With ListGalleries(wdOutlineNumberGallery).ListTemplate s(5).ListLevels(3) .NumberFormat = "%3." .TrailingCharacter = wdTrailingTab .NumberStyle = wdListNumberStyleLowercaseRoman .NumberPosition = InchesToPoints(1.75) .Alignment = wdListLevelAlignRight .TextPosition = InchesToPoints(2) .TabPosition = InchesToPoints(0) .ResetOnHigher = 2 .StartAt = 1 With .Font .Bold = wdUndefined .Italic = wdUndefined .StrikeThrough = wdUndefined .Subscript = wdUndefined .Superscript = wdUndefined .Shadow = wdUndefined .Outline = wdUndefined .Emboss = wdUndefined .Engrave = wdUndefined .AllCaps = wdUndefined .Hidden = wdUndefined .Underline = wdUndefined .Color = wdUndefined .Size = wdUndefined .Animation = wdUndefined .DoubleStrikeThrough = wdUndefined .Name = "" End With .LinkedStyle = "" End With With ListGalleries(wdOutlineNumberGallery).ListTemplate s(5).ListLevels(4) .NumberFormat = "%4." .TrailingCharacter = wdTrailingTab .NumberStyle = wdListNumberStyleArabic .NumberPosition = InchesToPoints(1.75) .Alignment = wdListLevelAlignLeft .TextPosition = InchesToPoints(2) .TabPosition = InchesToPoints(2) .ResetOnHigher = 3 .StartAt = 1 With .Font .Bold = wdUndefined .Italic = wdUndefined .StrikeThrough = wdUndefined .Subscript = wdUndefined .Superscript = wdUndefined .Shadow = wdUndefined .Outline = wdUndefined .Emboss = wdUndefined .Engrave = wdUndefined .AllCaps = wdUndefined .Hidden = wdUndefined .Underline = wdUndefined .Color = wdUndefined .Size = wdUndefined .Animation = wdUndefined .DoubleStrikeThrough = wdUndefined .Name = "" End With .LinkedStyle = "" End With With ListGalleries(wdOutlineNumberGallery).ListTemplate s(5).ListLevels(5) .NumberFormat = "%5." .TrailingCharacter = wdTrailingTab .NumberStyle = wdListNumberStyleLowercaseLetter .NumberPosition = InchesToPoints(2.25) .Alignment = wdListLevelAlignLeft .TextPosition = InchesToPoints(2.5) .TabPosition = InchesToPoints(2.5) .ResetOnHigher = 4 .StartAt = 1 With .Font .Bold = wdUndefined .Italic = wdUndefined .StrikeThrough = wdUndefined .Subscript = wdUndefined .Superscript = wdUndefined .Shadow = wdUndefined .Outline = wdUndefined .Emboss = wdUndefined .Engrave = wdUndefined .AllCaps = wdUndefined .Hidden = wdUndefined .Underline = wdUndefined .Color = wdUndefined .Size = wdUndefined .Animation = wdUndefined .DoubleStrikeThrough = wdUndefined .Name = "" End With .LinkedStyle = "" End With With ListGalleries(wdOutlineNumberGallery).ListTemplate s(5).ListLevels(6) .NumberFormat = "%6." .TrailingCharacter = wdTrailingTab .NumberStyle = wdListNumberStyleLowercaseRoman .NumberPosition = InchesToPoints(2.88) .Alignment = wdListLevelAlignRight .TextPosition = InchesToPoints(3) .TabPosition = InchesToPoints(3) .ResetOnHigher = 5 .StartAt = 1 With .Font .Bold = wdUndefined .Italic = wdUndefined .StrikeThrough = wdUndefined .Subscript = wdUndefined .Superscript = wdUndefined .Shadow = wdUndefined .Outline = wdUndefined .Emboss = wdUndefined .Engrave = wdUndefined .AllCaps = wdUndefined .Hidden = wdUndefined .Underline = wdUndefined .Color = wdUndefined .Size = wdUndefined .Animation = wdUndefined .DoubleStrikeThrough = wdUndefined .Name = "" End With .LinkedStyle = "" End With With ListGalleries(wdOutlineNumberGallery).ListTemplate s(5).ListLevels(7) .NumberFormat = "%7." .TrailingCharacter = wdTrailingTab .NumberStyle = wdListNumberStyleArabic .NumberPosition = InchesToPoints(3.25) .Alignment = wdListLevelAlignLeft .TextPosition = InchesToPoints(3.5) .TabPosition = InchesToPoints(3.5) .ResetOnHigher = 6 .StartAt = 1 With .Font .Bold = wdUndefined .Italic = wdUndefined .StrikeThrough = wdUndefined .Subscript = wdUndefined .Superscript = wdUndefined .Shadow = wdUndefined .Outline = wdUndefined .Emboss = wdUndefined .Engrave = wdUndefined .AllCaps = wdUndefined .Hidden = wdUndefined .Underline = wdUndefined .Color = wdUndefined .Size = wdUndefined .Animation = wdUndefined .DoubleStrikeThrough = wdUndefined .Name = "" End With .LinkedStyle = "" End With With ListGalleries(wdOutlineNumberGallery).ListTemplate s(5).ListLevels(8) .NumberFormat = "%8." .TrailingCharacter = wdTrailingTab .NumberStyle = wdListNumberStyleLowercaseLetter .NumberPosition = InchesToPoints(3.75) .Alignment = wdListLevelAlignLeft .TextPosition = InchesToPoints(4) .TabPosition = InchesToPoints(4) .ResetOnHigher = 7 .StartAt = 1 With .Font .Bold = wdUndefined .Italic = wdUndefined .StrikeThrough = wdUndefined .Subscript = wdUndefined .Superscript = wdUndefined .Shadow = wdUndefined .Outline = wdUndefined .Emboss = wdUndefined .Engrave = wdUndefined .AllCaps = wdUndefined .Hidden = wdUndefined .Underline = wdUndefined .Color = wdUndefined .Size = wdUndefined .Animation = wdUndefined .DoubleStrikeThrough = wdUndefined .Name = "" End With .LinkedStyle = "" End With With ListGalleries(wdOutlineNumberGallery).ListTemplate s(5).ListLevels(9) .NumberFormat = "%9." .TrailingCharacter = wdTrailingTab .NumberStyle = wdListNumberStyleLowercaseRoman .NumberPosition = InchesToPoints(4.38) .Alignment = wdListLevelAlignRight .TextPosition = InchesToPoints(4.5) .TabPosition = InchesToPoints(4.5) .ResetOnHigher = 8 .StartAt = 1 With .Font .Bold = wdUndefined .Italic = wdUndefined .StrikeThrough = wdUndefined .Subscript = wdUndefined .Superscript = wdUndefined .Shadow = wdUndefined .Outline = wdUndefined .Emboss = wdUndefined .Engrave = wdUndefined .AllCaps = wdUndefined .Hidden = wdUndefined .Underline = wdUndefined .Color = wdUndefined .Size = wdUndefined .Animation = wdUndefined .DoubleStrikeThrough = wdUndefined .Name = "" End With .LinkedStyle = "" End With ListGalleries(wdOutlineNumberGallery).ListTemplate s(5).Name = "" Selection.Range.ListFormat.ApplyListTemplate ListTemplate:=ListGalleries( _ wdOutlineNumberGallery).ListTemplates(5), ContinuePreviousList:=False, _ ApplyTo:=wdListApplyToWholeList, DefaultListBehavior:= _ wdWord10ListBehavior End Sub |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Two rows per row? | Tables | |||
Form Generaters in Word | Microsoft Word Help | |||
macro produces error message | Microsoft Word Help | |||
Possible bug when recording a Word Macro | Microsoft Word Help | |||
2000 to 2002 macro and "Could not open macro storage" | Mailmerge |