Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Counting pages in word document

Status
Not open for further replies.

kalle82

Technical User
Apr 2, 2009
163
SE
Hi!

Question 1: Is there a way to count the number of pages in a word document?

Question 2: The number i get from the counting of pages can i use that to put a text on that page´s header?

So like this..
Start counting... Document has 4 pages.
Add correct header to correct page!
Add the text "Beslut" to First page header
Add the text "Beslut" to Second page header
Add the text "Bilaga 1" to Third page header
Add the text "Bilaga 2" to Fourth page header

I have some problems constructing this funtcion..
But i believe that i must create a variable containing the pagenumber... Then i need to loop through every page to add the new header...
 
kalle82, regarding the use of the field codes, as macropod mentioned it is absolutely critical that you use Ctl-F9 to put the field brackets in - BOTH of them. It will not work if you typed the brackets.

I am not sure why you are using bookmarks in your headers. I am not fully following what you are doing. However, if:

But how should i write if i want
first page =beslut
second page = beslut
Third = bilaga 1
Fourth = bilaga 2

is what you want, as "first" and "second" pages are the same, I would make a Section break, like this:

first page =beslut
second page = beslut
-------Section break------------
Third = bilaga 1
Fourth = bilaga 2

Put "beslut" in the header for Section 1, and "bilaga " {PAGENUM} for Section 2...with Section 2 obviously restarting the page numbering at 1.

Gerry
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top