HELP page numbers in Word 2002 vba

  • Thread starter Thread starter lilian.morakabati
  • Start date Start date
L

lilian.morakabati

Hello,
I'm not quite sure how to describe this but here goes:

I'm having trouble getting the current pagenumber into a variable for
my vba code.

I have a document divided into sections. I'd like to print the page
number in the footer. Here is the kick: I`d like the page number to
reset back to 1 on each sections.

SO unless there is a easy microsoft way to do this, i`m thinking of
incrementing a integer on each page change... But how do i know which
page i'm on?

Can anybody tell me how to retreive the current page number of a
range/paragraph/selection
 
Hi Lilian,

Please don't reinvent the wheel. :-) There is already a feature in Word to
handle this, so you don't need a macro.

First to make sure: when you say the document is divided in sections, do you
mean you've inserted section breaks between them? That is necessary for the
next step to work.

Use the View > Header & Footer menu item to open the header area and display
the Header/Footer toolbar. You should see a dashed box around the header
area, with "Section 1 Header" written in the upper left.

Click the Show Next button (near the right end of the Header/Footer
toolbar), so you see "Section 2 Header" written in the upper left.

Click the Format Page Number button (third from the left on the toolbar) to
open a small dialog. At the bottom of the dialog, click the Start At option,
and make sure "1" appears in the box to the right. Click OK.

Continue clicking Show Next and then Format Page Number until you've set
each section's Start At to 1.

If you haven't placed a page number in the header (or footer) yet, click the
Insert Page Number button on the toolbar (next to Insert AutoText). You can
insert one or two tab characters to the left of the page number to make it
centered or at the right margin.

Click the Close button on the Header/Footer toolbar. Check out your new page
numbers!
 
Back
Top