Unchanging Line Numbers? Word 2007

  • Thread starter Thread starter W. eWatson
  • Start date Start date
W

W. eWatson

I would like to provide line numbers for each line of text, then remove
lines without having the doc renumbered. Is that possible?

1 hello
2 bye
3 home
4 quiz

goes to

2 bye
3 home

not
1 bye
2 home
 
I would like to provide line numbers for each line of text, then remove
lines without having the doc renumbered. Is that possible?

1 hello
2 bye
3 home
4 quiz

goes to

2 bye
3 home

not
1 bye
2 home

Assuming each line ends with a paragraph mark, and isn't wrapped or ended with
a line break (Shift+Enter):

Start by inserting a SEQ field at the start of each line. The quickest way to
do this is to
- use Insert > Field (in Word 2003) or Insert > Quick Parts > Field (in Word
2007 or 2010) to insert one on the first line, followed by a space;
- copy that field and space to the clipboard;
- then open the Replace dialog and enter
^p
in the Find What box and
^&^c
in the Replace With box, and click Replace All.

Now select all (Ctrl+A) and press F9 to update all the fields. Then either
- unlink all the fields (Ctrl+Shift+F9) to turn them into plain text;
or
- lock all the fields (Ctrl+F11) to prevent them from being updated later
unless you unlock them (Ctrl+Shift+F11).

Now the numbers won't change as you remove lines.
 
Assuming each line ends with a paragraph mark, and isn't wrapped or ended with
a line break (Shift+Enter):

Start by inserting a SEQ field at the start of each line. The quickest way to
do this is to
- use Insert> Field (in Word 2003) or Insert> Quick Parts> Field (in Word
2007 or 2010) to insert one on the first line, followed by a space;
- copy that field and space to the clipboard;
- then open the Replace dialog and enter
^p
in the Find What box and
^&^c
in the Replace With box, and click Replace All.

Now select all (Ctrl+A) and press F9 to update all the fields. Then either
- unlink all the fields (Ctrl+Shift+F9) to turn them into plain text;
or
- lock all the fields (Ctrl+F11) to prevent them from being updated later
unless you unlock them (Ctrl+Shift+F11).

Now the numbers won't change as you remove lines.

--
Regards,
Jay Freedman
Microsoft Word MVP
Email cannot be acknowledged; please post all follow-ups to the newsgroup so all may benefit.
I pretty sure they have a CR at the end. It's actually a computer
program listing.

It sure wasn't obvious if it could be done. :-) I'll give it a shot.
 
I went to Quck Parts and selected Field. It gives me a list of items like:
+
AddressBlock
Advance
....

I need more info on what is expected here. I had positioned the cursor
on the first character of the line. It's preceded by numeral 1 for the
line #.
 
Although you can select the SEQ field from that list, you can also insert a
SEQ field by just pressing Ctrl+F9 and typing SEQ whatever, where "whatever"
represents the name of your sequence. You'll get this field:

{ SEQ whatever }

SEQ fields don't update automatically when inserted unless you save one as
an AutoText entry and insert that, but Jay has given you a slicker way to do
it for your specific application. You'll need to disable Word's automatic
line numbering before using this numbering technique.

--
Suzanne S. Barnhill
Microsoft MVP (Word)
Words into Type
Fairhope, Alabama USA
http://word.mvps.org
 
Although you can select the SEQ field from that list, you can also
insert a SEQ field by just pressing Ctrl+F9 and typing SEQ whatever,
where "whatever" represents the name of your sequence. You'll get this
field:

{ SEQ whatever }

SEQ fields don't update automatically when inserted unless you save one
as an AutoText entry and insert that, but Jay has given you a slicker
way to do it for your specific application. You'll need to disable
Word's automatic line numbering before using this numbering technique.
SEQ. Ah, a choice in the list.OK,I put it into the front of the line.

1 COMMENT ...
^
^ is where the cursor is. It cannot to the farthest left. I put a Seq at
the cursor and get
Error! No sequence specified.

It appears to me needs some action earlier. Perhaps to set it to 1.

I see autoText as a QP field choice. Does it have a setting like
AutoText=Y? Is there a tutorial on QP. Never heard of it before.

If Jay's approach is the easiest, then I must be missing something. I
don't get past "on the first line,followed by a space;"
 
We can pursue this if it is instructive to others, at a more leisurely
pace. I converted the file to a txt file, and used a Python program I
wrote to number the txt file lines.
 
The SEQ field must contain a sequence identifier. In my example, I used
"whatever." You can call your sequence anything you want. To remove the
present line numbering, you must go to the Layout tab of Page Setup and turn
it off. Or, if you used Word's auto numbering, you need to turn that off.

For more on AutoText entries, see
http://word.mvps.org/FAQs/Customization/AutoText.htm.

--
Suzanne S. Barnhill
Microsoft MVP (Word)
Words into Type
Fairhope, Alabama USA
http://word.mvps.org
 
Back
Top