Group: microsoft.public.word.vba.general
From: "Doug Robbins - Word MVP"
Date: Sunday, April 06, 2008 2:56 AM
Subject: Re: Programing the page number

The best thing to do would be to create the document from a template that
already has the page number set up in it in the position that you want it.

However, the following code will add a { PAGE } field to the primary footer
of the first section in a document.

Dim frange As Range
With ActiveDocument
Set frange = .Sections(1).Footers(wdHeaderFooterPrimary).Range
.Fields.Add frange, wdFieldEmpty, "Page"
End With


--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

"juan" wrote in message
news:24B10AB8-1B75-45D5-9EFD-FC07F566989F@microsoft.com...
> Hello:
> I have an application of Visual Basic 2005. I can make a word XP document
> ("Document 1") by code inside the application. I want to put the page
> number
> in the document but I don't know how from inside the code of Visual Basic.
> That's the problem.
> Thanks
>