Re: Word 97 SEQ field question

Subject: Re: Word 97 SEQ field question
From: Ron Smith <rsmith01 -at- NORTELNETWORKS -dot- COM>
Date: Tue, 29 Jun 1999 13:50:07 -0400

Yaacov

You wrote on Mon, 28 Jun 1999 12:04:50 +0300:
--------
Would someone tell me how to format numbered steps using SEQ fields?
I would like the number font to be different from the instruction text that
follows it and I want the number to be a different color. The number should
also be followed by a decimal point and a large space before the
instruction text that follows it starts.
-------------------------

It's a common problem for which I've included two references:

1. The reference to David Knopf's Web page, showing the basics of using
the SEQ field. Although it's oriented to RoboHelp, it can be used in native
Word 97.

2. A post to the WINHLP-L ListServ from David Wilkins. This is a GREAT tip.
I use this exclusively. Since it includes the code for the macro, you can
make the changes necessary to format the lists as you've described.

Have fun with it.

Regards

Ron Smith
smith_ron -at- email -dot- com

(ps - please note the return address should be smith_ron -at- email -dot- com, not the
one generated automatically )

----------------------

1. David Knopf's web page

http://www.knopf.com/tips/01-autonumbering/autonumber.htm

----------------------

----------------------

2. 2. A post to the WINHLP-L ListServ from David Wilkins

Date: Friday, October 16, 1998 4:43 PM
From: David Wilkins [dwilkins -at- PDGINC -dot- COM]
Sent: Friday, October 16, 1998 4:43 PM
To: WINHLP-L -at- ADMIN -dot- HUMBERC -dot- ON -dot- CA
Subject: Another solution to SEQ codes and Word autoNumbering

Hey all,

For some time now, I have been lurking, reading, occasionally posting, and
generally loving the heck out of this list. You have helped me to develop
skills very quickly and have made me (on many occasions) look a little
smarter than I really am.

This was definitely the case regarding the whole issue of autoNumbering and
SEQ codes. For a couple of weeks now, I have been getting hosed by Word's
auto-numbering "feature", but didn't know the best way to handle it.
Fortunately, the archive had some answers and a pointer to David Knopf's
site with a detailed description of the steps needed to make this happen.
Kudos on a truly helpful site, David. For those of you who have not
visited David's site, I would highly recommend it: www.knopf.com

The one thing that I didn't like about the solution, though, was the idea
of typing each autocorrect entry as 1] or n]. Though I despise it's
useless numbering functionality, I like Word's ability to select the
paragraphs and then apply the number format to it. That way, you don't
need to type each entry, but can do them all at once after you've typed
your list. I therefore tried to combine the SEQ solution with the one
click style solution of Word autonumbering, through VBA.

There are two code snippets below. Please note this is a Word 97 only
solution. The first snippet, WholeNumberedList, formats a group of
paragraphs with the SEQ codes: SEQ Step \r 1 for the first paragraph in the
selection and SEQ Step \n for the remaining items in the group. The second
snippet, Number SEQ_2_and_higher, also formats a group of paragraphs with
SEQ codes, but only this one: SEQ Step \n. I use this code when I need the
equivalent of continue numbering for a complex list.

Once I made the routines, I added them to my RoboHelp.dot and then made
buttons on a custom toolbar to run them. Typical stuff.

I thought it was about time I gave something back to the list. Just to be
clear: my tweaking of this SEQ solution is not intended to replace the idea
of autoCorrect entries as a means to add SEQ numbers; it's just another way
to do it. I find it particularly helpful when I need to reformat existing
documentation that's already numbered with built-in Word styles. Since it
applies a style first, it removes the old numbered style and then replaces
it with SEQ fields in one fell swoop. I hope others find it as useful as I
have.

Please feel free to use and modify the code as you see fit. Here's hoping
in advance that it isn't butchered on the way to the list.

Dave Wilkins

Sub WholeNumberedList()
' Formats list with SEQ codes to number w/out Word autonumbering feature

Dim x As Integer

' Formats selected text with "Numbers" style (user defined)
' To change this, either change the name referenced below or rename your
numbering style as "Number"
Selection.Style = ActiveDocument.Styles("Numbers")
' Determines # of paragraphs in selection
x = Selection.Range.Paragraphs.Count
' Sets range to selection so can reset before select individual paragraphs
Set myRange = Selection.Range
For i = 1 To x
myRange.Select
Selection.Paragraphs(i).Range.Select
With Selection
.MoveUp Unit:=wdParagraph, Count:=1
' This is where the SEQ codes are entered
If i = 1 Then
.Fields.Add Range:=Selection.Range,
Type:=wdFieldEmpty, Text:= _
"SEQ Step \r 1",
PreserveFormatting:=True
Else
.Fields.Add Range:=Selection.Range,
Type:=wdFieldEmpty, Text:= _
"SEQ Step \n",
PreserveFormatting:=True
End If
' I like periods "." after my numbers. If you don't, change the line
' below to ".TypeText Text:= vbTab"
.TypeText Text:="." & vbTab
.MoveUp Unit:=wdParagraph, Count:=1,
Extend:=wdExtend
' I like my numbers bolded; if you don't, remove the line below.
' You could also use this to make your numbers red or blue or italics:
' e.g. Selection.Font.ColorIndex = wdRed or Selection.Font.Italic = true
Selection.Font.Bold = True
End With
Next
' This just moves cursor down to next paragraph
Selection.MoveDown Unit:=wdParagraph, Count:=1
End Sub


Sub NumberSeq_2_and_Higher()

' This code is basically the same as that above. The biggest difference is
that
' this code will not do the first SEQ to restart numbering. I use it when
I
' have a complex list with breaks in the middle so that I can continue my
numbering.
' Look to the code above for more ideas about customization.

Dim x As Integer

Selection.Style = ActiveDocument.Styles("Numbers")
x = Selection.Range.Paragraphs.Count
Set myRange = Selection.Range
For i = 1 To x
myRange.Select
Selection.Paragraphs(i).Range.Select
With Selection
.MoveUp Unit:=wdParagraph, Count:=1
.Fields.Add Range:=Selection.Range,
Type:=wdFieldEmpty, Text:= _
"SEQ Step \n", PreserveFormatting:=True
.TypeText Text:="." & vbTab
.MoveUp Unit:=wdParagraph, Count:=1,
Extend:=wdExtend
Selection.Font.Bold = True
End With
Next
Selection.MoveDown Unit:=wdParagraph, Count:=1
End Sub




Brought to you by:

Cambridge Publications, Inc.
One Harvard St., Suite 300, Brookline, MA 02146
(617)739-1860 voice, (617)277-9990 fax


----------------------


From ??? -at- ??? Sun Jan 00 00:00:00 0000=



Previous by Author: Are manuals out of date (no)
Next by Author: Training in Cascading Style Sheets
Previous by Thread: Word 97 SEQ field question
Next by Thread: Tools, Images, and other questions.


What this post helpful? Share it with friends and colleagues:


Sponsored Ads