Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.newusers
[email protected] vince.public@gmail.com is offline
external usenet poster
 
Posts: 2
Default Automatic "non-sequential" numbering in a requirements specification?

I'm trying to create a Word template for a requirements specification,
but I'm going nuts trying to figure out if I can cajole/beg/strong-arm
Word into handling something for me...

Let's say I define a style to be used for formatting a requirement
(call it "Requirement"... duh). Now in the simplest use of this style,
I could have a multiple paragraphs tagged with this style and can get
them to automatically be numbered in sequential order, e.g.:

REQ-1: blah blah blah
REQ-2: blah blah blah

(some filler text)

REQ-3: blah blah blah

(more filler text)

(etc.)

Now let's say I need to insert a new Requirement instance between the
existing REQ-1 and REQ-2 above. When I do this now, the new instance
becomes REQ-2; the old REQ-2 becomes REQ-3, the old REQ-3 becomes
REQ-4, etc. What I would *like* to do instead is have this new
instance be automatically numbered as REQ-4 (or whatever the next
highest "available" value is for this style).

Similarly, let's say that I delete REQ-3 above and add a new
Requirement instance somewhere. That new instance now becomes REQ-3,
but I'd *like* to have it be auto-numbered as REQ-4 (or whatever the
next highest "available value is for this style).

Can either/both of these behaviors be affected via... I don't know
what -- macros? clever use of [custom?] fields? magic?

Thanks,
- Vince
  #2   Report Post  
Posted to microsoft.public.word.newusers
[email protected] askteam.mail@gmail.com is offline
external usenet poster
 
Posts: 6
Default Automatic "non-sequential" numbering in a requirementsspecification?


I've done requirement in MS word before. Let understand the concept of
template first
before solving your numbering issue,

http://www.soi12.com/office/story.ph...f_template-Dot

http://www.soi12.com/office/story.ph...line_numbering



  #3   Report Post  
Posted to microsoft.public.word.newusers
Stefan Blom Stefan Blom is offline
external usenet poster
 
Posts: 8,428
Default Automatic "non-sequential" numbering in a requirements specification?

Something like this could be used:

Const CustomPath$ = "H:\settings.txt"
Sub InsertNumber()

'This is a modified version of the macro at
'http://word.mvps.org/faqs/macrosvba/NumberDocs.htm
'(by Doug Robbins)

Dim Order As String

Order = System.PrivateProfileString(CustomPath, _
"MacroSettings", "Order")

If Order = "" Then
Order = 1
Else
Order = Order + 1
End If

System.PrivateProfileString(CustomPath, "MacroSettings", _
"Order") = Order

Selection.InsertAfter "REQ-" & Order
Selection.Collapse wdCollapseEnd

End Sub

Note 1: The "current" number is stored in a text file (settings.txt). I used
"H:\settings.txt" as the full path for the text file. You should specify a
path that is relevant on your system.

Note 2: If you want to change the number set by the macro, for example when
you are creating a new document, just edit the number in the settings.txt
file.

Note 3: If you need installation instructions, see
http://www.gmayor.com/installing_macro.htm.

--
Stefan Blom
Microsoft Word MVP


wrote in message
...
I'm trying to create a Word template for a requirements specification,
but I'm going nuts trying to figure out if I can cajole/beg/strong-arm
Word into handling something for me...

Let's say I define a style to be used for formatting a requirement
(call it "Requirement"... duh). Now in the simplest use of this style,
I could have a multiple paragraphs tagged with this style and can get
them to automatically be numbered in sequential order, e.g.:

REQ-1: blah blah blah
REQ-2: blah blah blah

(some filler text)

REQ-3: blah blah blah

(more filler text)

(etc.)

Now let's say I need to insert a new Requirement instance between the
existing REQ-1 and REQ-2 above. When I do this now, the new instance
becomes REQ-2; the old REQ-2 becomes REQ-3, the old REQ-3 becomes
REQ-4, etc. What I would *like* to do instead is have this new
instance be automatically numbered as REQ-4 (or whatever the next
highest "available" value is for this style).

Similarly, let's say that I delete REQ-3 above and add a new
Requirement instance somewhere. That new instance now becomes REQ-3,
but I'd *like* to have it be auto-numbered as REQ-4 (or whatever the
next highest "available value is for this style).

Can either/both of these behaviors be affected via... I don't know
what -- macros? clever use of [custom?] fields? magic?

Thanks,
- Vince










  #4   Report Post  
Posted to microsoft.public.word.newusers
Stefan Blom Stefan Blom is offline
external usenet poster
 
Posts: 8,428
Default Automatic "non-sequential" numbering in a requirements specification?

If numbering should be document-specific, you can make use of these macros
instead (place them in the attached template):

Sub InsertNumberInDoc()
Dim v As Variable
If VarExists("test") = False Then
ActiveDocument.Variables.Add "test", 0
End If

Set v = ActiveDocument.Variables("test")

If IsNumeric(v.Value) And v.Value = 0 Then
v.Value = v.Value + 1
Else
v.Value = 1
End If

Selection.InsertAfter "REQ-" & v.Value
Selection.Collapse wdCollapseEnd

End Sub

Function VarExists(VarName As String) As Boolean
Dim v As Variable
For Each v In ActiveDocument.Variables
If v.Name = VarName Then
VarExists = True
Exit Function
End If
Next v
End Function

Attach the InsertNumberInDoc sub-routine to a toolbar button (Word 97-2003)
or add it to the Quick Access Toolbar (Word 2007). Also, you can assign a
keyboard shortcut.

See also http://www.gmayor.com/installing_macro.htm.

--
Stefan Blom
Microsoft Word MVP


"Stefan Blom" wrote in message
...
Something like this could be used:

Const CustomPath$ = "H:\settings.txt"
Sub InsertNumber()

'This is a modified version of the macro at
'http://word.mvps.org/faqs/macrosvba/NumberDocs.htm
'(by Doug Robbins)

Dim Order As String

Order = System.PrivateProfileString(CustomPath, _
"MacroSettings", "Order")

If Order = "" Then
Order = 1
Else
Order = Order + 1
End If

System.PrivateProfileString(CustomPath, "MacroSettings", _
"Order") = Order

Selection.InsertAfter "REQ-" & Order
Selection.Collapse wdCollapseEnd

End Sub

Note 1: The "current" number is stored in a text file (settings.txt). I
used
"H:\settings.txt" as the full path for the text file. You should specify a
path that is relevant on your system.

Note 2: If you want to change the number set by the macro, for example
when
you are creating a new document, just edit the number in the settings.txt
file.

Note 3: If you need installation instructions, see
http://www.gmayor.com/installing_macro.htm.

--
Stefan Blom
Microsoft Word MVP


wrote in message
...
I'm trying to create a Word template for a requirements specification,
but I'm going nuts trying to figure out if I can cajole/beg/strong-arm
Word into handling something for me...

Let's say I define a style to be used for formatting a requirement
(call it "Requirement"... duh). Now in the simplest use of this style,
I could have a multiple paragraphs tagged with this style and can get
them to automatically be numbered in sequential order, e.g.:

REQ-1: blah blah blah
REQ-2: blah blah blah

(some filler text)

REQ-3: blah blah blah

(more filler text)

(etc.)

Now let's say I need to insert a new Requirement instance between the
existing REQ-1 and REQ-2 above. When I do this now, the new instance
becomes REQ-2; the old REQ-2 becomes REQ-3, the old REQ-3 becomes
REQ-4, etc. What I would *like* to do instead is have this new
instance be automatically numbered as REQ-4 (or whatever the next
highest "available" value is for this style).

Similarly, let's say that I delete REQ-3 above and add a new
Requirement instance somewhere. That new instance now becomes REQ-3,
but I'd *like* to have it be auto-numbered as REQ-4 (or whatever the
next highest "available value is for this style).

Can either/both of these behaviors be affected via... I don't know
what -- macros? clever use of [custom?] fields? magic?

Thanks,
- Vince

















  #5   Report Post  
Posted to microsoft.public.word.newusers
[email protected] vince.public@gmail.com is offline
external usenet poster
 
Posts: 2
Default Automatic "non-sequential" numbering in a requirementsspecification?

@askteam: My work is already being done in the context of templates,
but those were still a couple of useful links -- thanks!

@Stefan: Thanks for the detailed info! I'll definitely give those
(probably the 2nd option) a go.

- Vince


  #6   Report Post  
Posted to microsoft.public.word.newusers
Stefan Blom Stefan Blom is offline
external usenet poster
 
Posts: 8,428
Default Automatic "non-sequential" numbering in a requirements specification?

Thank you for the feedback.

Please post back if you run into trouble.

--
Stefan Blom
Microsoft Word MVP


wrote in message
...
@askteam: My work is already being done in the context of templates,
but those were still a couple of useful links -- thanks!

@Stefan: Thanks for the detailed info! I'll definitely give those
(probably the 2nd option) a go.

- Vince




Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
remove automatic sentence that comes up in "new blank document" basic help Microsoft Word Help 2 May 25th 06 01:10 PM
"automatic" font color black, not blue. How do I change this? Brian Microsoft Word Help 2 February 27th 06 03:35 PM
From WORD "Content & Figures Tables" to PPT automatic presentation Emmanuel Livne Microsoft Word Help 0 November 28th 05 07:16 PM
Automatic Sequential Numbering Helen B Microsoft Word Help 2 September 26th 05 02:07 PM
How do I print labels with automatic sequential numbering? wordheather123 Page Layout 1 May 14th 05 09:01 AM


All times are GMT +1. The time now is 02:11 PM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"