Need Macro for paragraph numbering, inside para, with a defined start point.

A

Andy

I've got both parts, but can't get them into one macro.

1st: This macro inserts an AutoNumLgl field at exactly where my
insertion point is, then consecutively numbers each paragrph when I
run the macro.
(I assigned it to Alt N.)

Sub AutoNumAltN()
'
Selection.Fields.Add Range:=Selection.Range, Type:=wdFieldEmpty,
Text:= _
"AUTONUMLGL \e ", PreserveFormatting:=False
End Sub

2nd: This macro numbers the beginning of a Header at the Start Point I
define, i.e. 29. (I assigned it to Alt 6.)

Sub AutoNumAt_Alt6()
'
Dim bText
bText = InputBox("Start At:")
With ListGalleries(wdNumberGallery).ListTemplates(1).ListLevels(1)
.NumberFormat = "%1"
.TrailingCharacter = wdTrailingTab
.NumberStyle = wdListNumberStyleArabic
.NumberPosition = InchesToPoints(0.25)
.Alignment = wdListLevelAlignLeft
.TextPosition = InchesToPoints(0.5)
.TabPosition = InchesToPoints(0.5)
.ResetOnHigher = 0
.StartAt = bText
.LinkedStyle = ""
End With
ListGalleries(wdNumberGallery).ListTemplates(1).Name = ""
Selection.Range.ListFormat.ApplyListTemplate
ListTemplate:=ListGalleries( _
wdNumberGallery).ListTemplates(1),
ContinuePreviousList:=False, ApplyTo:= _
wdListApplyToWholeList,
DefaultListBehavior:=wdWord10ListBehavior
End Sub

Now - could anyone out there give me the macro that will allow me to
number consecutive paragraphs, from within the paragraph (not in front
of the header) at the start # I define? A combination of these two.
Please?
 
C

Chad DeMeyer

Andy,

The AUTNUMLGL field does not support restarts or jumps in numbering. The
LISTNUM field can be used with an "\s" switch which allows you to specify
the starting number, but when I played with this I could not figure out how
to get the LISTNUM field to include the full context of heading numbers. It
would always precede the lowest level with ones (e.g., 1.x, 1.1.x, 1.1.1.x)
even when following a heading number such as, e.g., 2.3.4 (I get 1.1.1.x).
So unless somebody else knows some fancy trick to make it work, I don't
think a macro is going to be able to do what you want. A SEQ field preceded
by a STYLEREF field (just like figure and table captions) would almost work,
except that the STYLEREF field would be hardcoded to a particular heading
style, so if you inserted a different level heading above the paragraph,
your STYLEREF field wouldn't automatically update to reflect that heading as
being the closest context for the LISTNUM field that follows.

Sorry I couldn't be of more help,
Regards,
Chad
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top