Add line numbers to text selection

J

Jason

Hi,

I write programming manuals which require me to frequently paste code
snippets into a Word document. For this particular manual each line of
code must be numbered like so:

01 first code line...
02 blank line
03 more code here
04 more code
05 more code
06 blank line
07 more code

As you can see, even the blank lines should be numbered. However, I
can find no Word feature which performs this task. I've attempted
various hacks, such as applying a custom numbered list to the
selection, however Word will not number blank lines.

Leaving me to believe the only practical way to do this is through a
macro. Admittedly my Word macro writing skills aren't up to snuff, and
so I thought I'd throw this question out to the list to see whether
somebody has a similar macro available.

Thank you,
Jason
 
S

Suzanne S. Barnhill

Have you tried using the Line Numbers feature? File | Page Setup | Layout:
Line numbers (continuous). This might be okay for an entire doc, but for
code snippets (especially if you need the leading zero), you might be better
off with a SEQ field.
 

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