0 Replies Latest reply on May 13, 2011 5:19 AM by tonymacp

    Add page number in footer through VBA


      Hi Everyone,


      First post so be gentle with me.


      I have inherited an Excel app which creates a pdf file, and I have been asked to add page numbers to the pdf. So I am hoping I can do this from VBA. So far I have found this way to access the pdf doc from VBA:

      Sub myPDF()
          Dim app As Object, avDoc As Object
          Dim stTest As String
          Dim stPath As String
          stPath = "C:\"
          stTest = "Test.pdf"
          Set app = CreateObject("AcroExch.App")
          Set avDoc = CreateObject("AcroExch.AVDoc")
          If avDoc.Open(stPath & stTest, "") Then
              If avDoc.IsValid = False Then Exit Sub
          End If
          Set app = Nothing
          Set avDoc = Nothing
      End Sub



      So that opens the required PDF file. Now I'm hoping that I can do the equivalent of :


      Document....Header & Footer....Add


      and set it up to display the page numbers in the centre footer of each page.


      Thanks for any help,