static sequence number in Word 2003

N

NMadson

Is there anyway to assign a static sequence number to an outline numbered
paragraph and then create a table at the end using that sequence number? I
want the sequence number to remain constant regardless of how I re-order the
document. Then at the end of the document I'd like to be able to create
something like a Table of Contents or Table of Authorities which lists my
sequence number, the line of text associated with that sequence number and
the outline number of that line of text.

While I could assign a static sequence number as I'm first writing the
document, as I edit the document and add or delete entries, I'll loose track
of the last sequence number and what the next one should be - unless I keep a
separate document of that number.
 
D

Doug Robbins

This is not the greatest bit of code as I have learnt a lot in the meantime:

' Macro created 12/06/98 by Doug Robbins to insert sequential unlinked
numbers.

'

For Each aVar In ActiveDocument.Variables

If aVar.Name = "SeqNum" Then num = aVar.Index

Next aVar

If num = 0 Then

ActiveDocument.Variables.Add Name:="SeqNum", Value:=1

Else

ActiveDocument.Variables(num).Value =
ActiveDocument.Variables(num).Value + 1

End If

With ActiveDocument

.Fields.Add Range:=Selection.Range, _

Type:=wdFieldDocVariable, Text:="Seqnum \# ""0000"""

End With

Selection.HomeKey Unit:=wdLine

Selection.Extend

Selection.EndKey Unit:=wdLine

Selection.Fields.Unlink

ActiveDocument.ActiveWindow.View.ShowFieldCodes = False

Selection.Collapse Direction:=wdCollapseEnd

Selection.TypeParagraph
--
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
 
D

Doug Robbins

Better things to do in Paris.

--
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
 
J

John McGhie [MVP - Word and Word Macintosh]

What I usually do is set up normal dynamic numbering and let the document
number automatically, then use "ConvertNumbersToText" before re-ordering the
document.

Sub ConvertNumbers()
' Converts all numbers to text
Dim doIt As Integer

doIt = MsgBox("This macro converts all automatic numbers in the document to
text. This is a one-time operation. Are you sure?", vbOKCancel)

If doIt = 1 Then
ActiveDocument.ConvertNumbersToText
MsgBox "All numbering converted to typed text."
End If

End Sub


Is there anyway to assign a static sequence number to an outline numbered
paragraph and then create a table at the end using that sequence number? I
want the sequence number to remain constant regardless of how I re-order the
document. Then at the end of the document I'd like to be able to create
something like a Table of Contents or Table of Authorities which lists my
sequence number, the line of text associated with that sequence number and
the outline number of that line of text.

While I could assign a static sequence number as I'm first writing the
document, as I edit the document and add or delete entries, I'll loose track
of the last sequence number and what the next one should be - unless I keep a
separate document of that number.

--

Please reply to the newsgroup to maintain the thread. Please do not email
me unless I ask you to.

John McGhie <[email protected]>
Microsoft MVP, Word and Word for Macintosh. Consultant Technical Writer
Sydney, Australia +61 4 1209 1410
 

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