Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.word.newusers
|
|||
|
|||
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
Posted to microsoft.public.word.newusers
|
|||
|
|||
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
Posted to microsoft.public.word.newusers
|
|||
|
|||
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
Posted to microsoft.public.word.newusers
|
|||
|
|||
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
Posted to microsoft.public.word.newusers
|
|||
|
|||
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
Posted to microsoft.public.word.newusers
|
|||
|
|||
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 | |
|
|
Similar Threads | ||||
Thread | Forum | |||
remove automatic sentence that comes up in "new blank document" | Microsoft Word Help | |||
"automatic" font color black, not blue. How do I change this? | Microsoft Word Help | |||
From WORD "Content & Figures Tables" to PPT automatic presentation | Microsoft Word Help | |||
Automatic Sequential Numbering | Microsoft Word Help | |||
How do I print labels with automatic sequential numbering? | Page Layout |