Trevor
09-16-2004, 01:15 AM
How does one go about changing the page number value within a word document with VBA? Forgive me for the sinmplicity of the question, but I have no experience with VBA in Word (mostly only Excel).
I have a document that I need to print page numbers onto. My idea was to scan it into my computer, insert it as an image into Word, insert a page number, print, change the page number and print again. But I don't know how
Here is what I got so far:
---------------------------------------------------------
Sub pageNumber()
With ActiveDocument.Sections(1)
.Footers(wdHeaderFooterPrimary).PageNumbers.Add _
PageNumberAlignment:=wdAlignPageNumberRight, _
FirstPage:=True
End With
ActiveDocument.PrintOut
For i = 2 To 2000
'this is where I need help
With ActiveDocument.Sections(1)
.Footers(wdHeaderFooterPrimary).PageNumbers = i
End With
ActiveDocument.PrintOut
Next i
End Sub
-------------------------------------------------
Thanks for the help.
T
I have a document that I need to print page numbers onto. My idea was to scan it into my computer, insert it as an image into Word, insert a page number, print, change the page number and print again. But I don't know how
Here is what I got so far:
---------------------------------------------------------
Sub pageNumber()
With ActiveDocument.Sections(1)
.Footers(wdHeaderFooterPrimary).PageNumbers.Add _
PageNumberAlignment:=wdAlignPageNumberRight, _
FirstPage:=True
End With
ActiveDocument.PrintOut
For i = 2 To 2000
'this is where I need help
With ActiveDocument.Sections(1)
.Footers(wdHeaderFooterPrimary).PageNumbers = i
End With
ActiveDocument.PrintOut
Next i
End Sub
-------------------------------------------------
Thanks for the help.
T