Set the starting pharagraph number

M

magobe

Hello
I have a document where several users want's to set the starting
number of a pharagraph style to different numbers. I don't think I can
teach them to go through the Customise Outline Numbered List dialog
box so I would like to have a macro presenting them with a dialog box
where they can enter the starting number, i.e. setting the .StarAt
value of ListGalleries to a number other than 1.
Thanks
magobe
 
L

Larry

This will help get you started. I recorded a macro of changing the
start number of a paragraph through the B&N dialog box. Then I erased
all the irrelevant stuff from the resulting macro, and turned it into a
simple input box. This works to change (or assign) a number for any
paragraphs, but since you are working through styles, and not through
the regular B&N dialog box, you will need to record your own macro, and
do with it what I did with this.


x = InputBox("Input desired paragraph number", "Set number for
paragraph")
With ListGalleries(wdNumberGallery).ListTemplates(7).ListLevels(1)
.StartAt = x
End With

ListGalleries(wdNumberGallery).ListTemplates(7).Name = ""
Selection.Range.ListFormat.ApplyListTemplate
ListTemplate:=ListGalleries( _
wdNumberGallery).ListTemplates(7), ContinuePreviousList:=False,
ApplyTo:= _
wdListApplyToWholeList

Larry
 
L

Larry

Sorry, I misunderstood you before. I was thinking you wanted to change
the number of a subsequent paragraph in a sequence, say change paragraph
# 3 to #6. You just want the starting number of the numbering style to
change. Just do the same thing I talked about before. Click cursor in
any paragraph with that style, start recording, click Format, Style to
topen the Style dialog, then Modify, Format, Numbering. Then go into
the Customize sub-dialog and change the number.

I did this with my own number style, then adapted the code into an input
box. You'd have to record your own version of this, because your specs
would all be different, but this gives you an idea of what to do.

x = InputBox("input desired starting number", "Change Style Numbering")
With ActiveDocument.Styles("number")
.AutomaticallyUpdate = False
.BaseStyle = "Normal"
.NextParagraphStyle = "number"
End With
With ListGalleries(wdNumberGallery).ListTemplates(2).ListLevels(1)
.StartAt = x
.LinkedStyle = "number"
End With
ActiveDocument.Styles("number").LinkToListTemplate ListTemplate:= _
ListGalleries(wdNumberGallery).ListTemplates(2), ListLevelNumber:=1
Selection.Style = ActiveDocument.Styles("number")


It may not be possible to change
 
M

magobe

Hello
I'm sorry I haven't answered to your suggestions before but I haven't
had the time to test them until today. And............they worked.
After a little tweaking I got exactly the result I was hoping for and
it helps me a lot. A big BIG thank you for your help.

magobe
 

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