Heading numbering with SEQ fields in a multisectioned document

T

techrighter

Hello all -

I have created a template for a multi-sectioned document that uses
successive SEQ fields to apply outline numbering to the headings. I
have done it this way to avoid the pitfalls associated with Word's
outline numbering system. The numbering works fine, as long as the
writer is working on one, long multisection document.

My problem is as follows: Some of the writers work on sections (or
chapters, if you will) of the document in isolation from the main
document. Because of the way the numbering works, all of the headings
the section start with 1 in that case, because it is the only section
in the document. The sections are also sent to reviewers seperate from
the main document and it would cause confusion if the wrong heading
numbers were on the document that the reviewer receives.

I know that I could manually change the numbering macros to start the
section numbering with a different number by using the reset switch for
the Seq field that specifies that number (SEQ s1), but what I need is a
method to have that happen automatically. Specifically, I want to have
an input box pop up when the section is started that asks for the
section number, then, after the user inputs the section number, I want
to write it to the r switch on the SEQ s1 field. Unfortunately, my
command of VBA is not good enough to do that on my own.

Here is one of the macros I'm using for my numbering. This one
specifies the numbering and formatting for heading level 3:

' level3 Macro
'
Selection.Fields.Add Range:=Selection.Range, Type:=wdFieldEmpty,
Text:= _
"SEQ s1\c", PreserveFormatting:=True
Selection.TypeText Text:="."
Selection.Fields.Add Range:=Selection.Range, Type:=wdFieldEmpty,
Text:= _
"SEQ s2 \c", PreserveFormatting:=True
Selection.TypeText Text:="."
Selection.Fields.Add Range:=Selection.Range, Type:=wdFieldEmpty,
Text:= _
"SEQ s3", PreserveFormatting:=True
'Selection.TypeText Text:="."
Selection.Fields.Add Range:=Selection.Range, Type:=wdFieldEmpty,
Text:= _
"SEQ s4 \r 0 \h", PreserveFormatting:=True
Selection.TypeText Text:=vbTab
Selection.Style = ActiveDocument.Styles("Heading 3")
Selection.MoveLeft Unit:=wdCharacter, Count:=2, Extend:=wdExtend
Selection.Fields.update
Selection.MoveRight Unit:=wdCharacter, Count:=1
Selection.HomeKey Unit:=wdLine, Extend:=wdExtend
If Selection.Font.Underline = wdUnderlineNone Then
Selection.Font.Underline = wdUnderlineSingle
Else
Selection.Font.Underline = wdUnderlineNone
End If
Selection.MoveRight Unit:=wdCharacter, Count:=1
If Selection.Font.Underline = wdUnderlineNone Then
Selection.Font.Underline = wdUnderlineSingle
Else
Selection.Font.Underline = wdUnderlineNone
End If
End Sub

I already have the code I need for the input boxes - all I need to know
is how to use that input to specify the value of the Seq s1 field. Once
that's set, it should stay the same whether the chapter is part of the
main document, or cut out to send to a reviewer, correct?

TIA

Techrighter
 
D

Doug Robbins - Word MVP

I believe that the switch that you should be using is \r which sets the
numbering to begin at the number following the r

If you put the following code in an autonew macro in the template from which
the documents are created, it will ask the user for the starting number and
then set a Seq field that starts from that number:

Dim i As Long
i = InputBox("Enter the Starting Number")
ActiveDocument.Fields.Add Range:=Selection.Range, Text:="SEQ mynumbering \r"
& i

I suggest however that you take a look at the following page on fellow MVP
Shauna Kelly's website:

http://www.shaunakelly.com/word/numbering/OutlineNumbering.html

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 
T

techrighter

Doug said:
I believe that the switch that you should be using is \r which sets the
numbering to begin at the number following the r

If you put the following code in an autonew macro in the template from which
the documents are created, it will ask the user for the starting number and
then set a Seq field that starts from that number:

Dim i As Long
i = InputBox("Enter the Starting Number")
ActiveDocument.Fields.Add Range:=Selection.Range, Text:="SEQ mynumbering \r"
& i

Thank you very much, Doug. This does exactly what I want it to do!
I suggest however that you take a look at the following page on fellow MVP
Shauna Kelly's website:

http://www.shaunakelly.com/word/numbering/OutlineNumbering.html

Been there, done that. I've been burned by Word's Outline numbering too
many times to trust it!
 

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