Numbered List (non-sequential)

B

brandon

Hi, we are writing a requirements doc, with requirement numbers in-line
with the text. ex. [ req 1 ]

We need these to be numbered, but not necessarily in a sequential
order- if we had a list of 50 requirements, then went back at a later
date and entered a *new* requirement between 14 & 15, it would need to
be numbered '51'.

I can't find anything (Bookmarks, cross-references, etc) that will do
non-sequential numbering automatically.

Can anyone here help?

Thanks very much, and I can clear it up further if anyone has
questions.

-Brandon
 
S

Suzanne S. Barnhill

Given your requirements, I don't see any way (or reason) to do this other
than with manual numbering. Since the numbering is not going to change (and
indeed must not change), there is no need for auto numbering.
 
B

brandon

Suzanne, thanks for your reply. The problem is, we have 200+
requirements throughout the doc, and over time it is very hard to do
manually and guarantee no repetition. Certainly automation will speed
things up and eliminate repetitions.
 
D

Doug Robbins - Word MVP

Use a macro containing the following code:

' 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
 
B

brandon

Doug, Thanks very much for your help.

When I attempt to run the Macro, I get an invalid syntax error here:

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




Is this underscore supposed to be there? It says it's an invalid
character.

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



Thanks again for all your help.

-Brandon
 
D

Doug Robbins - Word MVP

The following is a single command and in the visual basic editor, it needs
to be either all on one line or have a line break character inserted (the
space plus and underscore after the =)

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


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

brandon

Doug, I know this might be pushing my luck- but you have been the most
help out of anyone I've talked to.

Can I have this macro run-

search for the word "shall" and insert [req ####] Before the first word
in the sentence? These requirements are unfortunately not in bulleted
list form, but rather in paragraph form.

I then have to populate a table with these requirements (sentences) and
their respective req #'s, but I've found a fairly simple way to do
that.


Thanks for all your help once again.

-Brandon
 
D

Doug Robbins - Word MVP

Try this:

Dim srange As Range
Dim i As Long
i = 1
Selection.HomeKey wdStory
Selection.Find.ClearFormatting
With Selection.Find
Do While .Execute(FindText:="shall", MatchWildcards:=False, _
MatchCase:=False, Wrap:=wdFindStop, Forward:=True) = True
Set srange = Selection.Paragraphs(1).Range '.Duplicate
Selection.Collapse wdCollapseEnd
Selection.MoveRight wdCharacter, 1
srange.InsertBefore "req " & Format(i, "0000") & vbTab
i = i + 1
Loop
End With


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

brandon said:
Doug, I know this might be pushing my luck- but you have been the most
help out of anyone I've talked to.

Can I have this macro run-

search for the word "shall" and insert [req ####] Before the first word
in the sentence? These requirements are unfortunately not in bulleted
list form, but rather in paragraph form.

I then have to populate a table with these requirements (sentences) and
their respective req #'s, but I've found a fairly simple way to do
that.


Thanks for all your help once again.

-Brandon





The following is a single command and in the visual basic editor, it
needs
to be either all on one line or have a line break character inserted (the
space plus and underscore after the =)

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


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

brandon

Hey Doug, that's awesome. Thanks, I hope this helps more than just
myself.

Any way to get that to only apply to highlighted text?


Thanks !!!!!!!!

-Brandon



Try this:

Dim srange As Range
Dim i As Long
i = 1
Selection.HomeKey wdStory
Selection.Find.ClearFormatting
With Selection.Find
Do While .Execute(FindText:="shall", MatchWildcards:=False, _
MatchCase:=False, Wrap:=wdFindStop, Forward:=True) = True
Set srange = Selection.Paragraphs(1).Range '.Duplicate
Selection.Collapse wdCollapseEnd
Selection.MoveRight wdCharacter, 1
srange.InsertBefore "req " & Format(i, "0000") & vbTab
i = i + 1
Loop
End With


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

brandon said:
Doug, I know this might be pushing my luck- but you have been the most
help out of anyone I've talked to.

Can I have this macro run-

search for the word "shall" and insert [req ####] Before the first word
in the sentence? These requirements are unfortunately not in bulleted
list form, but rather in paragraph form.

I then have to populate a table with these requirements (sentences) and
their respective req #'s, but I've found a fairly simple way to do
that.


Thanks for all your help once again.

-Brandon





The following is a single command and in the visual basic editor, it
needs
to be either all on one line or have a line break character inserted (the
space plus and underscore after the =)

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


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

Doug, Thanks very much for your help.

When I attempt to run the Macro, I get an invalid syntax error here:

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




Is this underscore supposed to be there? It says it's an invalid
character.

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



Thanks again for all your help.

-Brandon
 

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