From: Swami on
I am looking to progammatically add page numbers to a PDF using VBA. I create
a multi-page PDF using various Excel reports. The PDF then needs to be
numbered sequentially. I have been able to research and find code to add a
watermark to the PDF, but, no luck on page numbering. I am using Excel 2007
and Acrobat 9.

Code Example:
Sub WatermarkPDF()

Dim bolResult As Boolean
Dim pdfDoc1 As AcroPDDoc
Dim jsObj As Object

Set pdfDoc1 = CreateObject("AcroExch.PDDoc")

If pdfDoc1.Open("C:\Test\Ranges\Reports\Custom_Merged.pdf") Then
Set jsObj = pdfDoc1.GetJSObject
jsObj.addWatermarkFromText ("Confidential")
End If

savepgnumfile = pdfDoc1.Save(1,
"C:\Test\Ranges\Reports\Custom_Merged_Watermark.pdf")

pdfDoc1.Close

Set jsObj = Nothing
Set pdfDoc1 = Nothing

End Sub