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")
    app.Show
    Set avDoc = CreateObject("AcroExch.AVDoc")
    If avDoc.Open(stPath & stTest, "") Then
        If avDoc.IsValid = False Then Exit Sub
        avDoc.BringToFront
    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,
Tony

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")
    app.Show
    Set avDoc = CreateObject("AcroExch.AVDoc")
    If avDoc.Open(stPath & stTest, "") Then
        If avDoc.IsValid = False Then Exit Sub
        avDoc.BringToFront
    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,
Tony

Similar Messages

  • Can i combine pdf, word and powerpoint into 1 pdf, and add page number?

    hi, i've been tasked to create a proposal combining these document types into 1 pdf. does anyone know if i can add page number as well, before i pay for subscription?
    thank you!!

    Hi,
    Combine Files tool in PDF Pack can combine multiple files into a single PDF file, but adding page number to each page of the single PDF file has be done in Adobe Acrobat.
    You can subscribe to Acrobat Plus or download Acrobat XI Pro trial version  from www.adobe.com.  Please see more information about Acrobat Plus subscription at https://www.acrobat.com/acrobatplus/en/home.html?trackingid=JPZKR.
    How to add page number in PDF file using Acrobat XI Pro:
    1. Open a PDF file
    2. Select "Tools" from top right corner
    3. Select "Pages" tab
    4. Select "Header & Footer"
    5. Select "Add Header & Footer" from pull down menu
    6. Select location for page number then click "Insert Page Number" button
    7. Click "OK" button
    Hisami

  • How can i add page number?

    how can i add page number in pages...???

    Maybe reading Pages User Guide would be a good idea.
    Yvan KOENIG (VALLAURIS, France) dimanche 26 février 2012
    iMac 21”5, i7, 2.8 GHz, 12 Gbytes, 1 Tbytes, mac OS X 10.6.8 and 10.7.3
    My Box account  is : http://www.box.com/s/00qnssoyeq2xvc22ra4k

  • Customer contact ( VAP1 )  add pager number with BDC

    hi ,
        While creating Customer Contact for Pager number entry there is a POP alv , from where Pager need to be selected . while recording BDC it doesnt copy that Okcodes for the POP UP ALV  .
       So how to Add Pager number for mass upload .
    Ashok

    This has been noted by a few people, must have been either a mistake or Blackberry's way of cutting down on the drug trade. Do drug dealers even use pagers anymore? Just kidding!
    I would call the issue into your Carrier's Blackberry support team so that it gets officially recognized and fixed in a future release.
    As a workaround for now I can suggest moving the pager numbers to any other type of telephone field.
    -: DrewRead :-
    Can't find an app on Blackberry World yet? Tweet the developer and ask when they will #GetWithBB10 !!
    "Like it" if you like it.

  • Adding Page Number in PDF using VBA

    Hi,
    I need to add page numbers to around 8000 PDF files via excel VBA. I would need to do this every month. I am new to VBA coding but I can manage to write a decent code. It would be great if any one of you would share a VBA code that would allow me to add page numbers to PDF files. I have Adobe professional 6.0.
    This is kind URGENT. All help will be welcome !!!
    Thanks

    Hi Vivek,
    Could you please test the following solutions to resolve the issue.
    Solution1:
    To display the page numbers from the first according to the section details i.e based on the number of sections in a report.
    example: If a report has3 sctions and first section comes in 3 pages,2nd section comes in 4 pages and 3rd section in 2 pages, then total number of pages is9. Then the display of page numbers should be [page number of section in(1,2or3)/total number of pages in all the sections]
      Insert a cell within a page and insert the formula
    =Concatenation("Page"" " ,PageInSection(1)" ")
    If the above doesnu2019t works then please try the following solution.
    Solution2:
    --Create a report with section.
    --Format the Section to "Start on a new page"
    --Apply Page Layout to the report
    --Insert a Cell and apply function  PageInSection()
    I hope this will help you.
    Regards,
    Deepti Bajpai

  • Add page number

    How Do I easily add page numbers to all the pages in my document...?
    Do I really have to manually create a textbox and put a number in it or add a text variable to each and every page? Is't there like some kind of one button push like microsoft word has?

    Euh... I don't know. Can you explain the difference to me? Cause I'm working in french and it's difficult to be sure

  • Possible to always display page number in footer on outside of facing page?

    Is it possible to configure the page number in a footer to always display on the outside of the facing page?

    In the Layout Inspector, in the Section tab, check "Left and right pages are different", then put the page numbers in the appropriate places on the left and right pages.

  • Page Number in footer won't print

    I am working in Adobe Acrobat Pro 9.0.0.  The document is combined of imported Microsoft Word & Excel 2010.  I have been able to add a background and a footer with the page numbers.  Both show in the electronic document.  When I print, only the background prints, not the footer with the page numbers.  Is there a setting I can change or something else I need to do in order to have the page numbers print?
    -Cayce

    You may have a better chance to get an answer if you ask Acrobat questions in the Acrobat forum.

  • How to start page number in footer lower down

    I'm creating an inventory catalog and I need to have all the pages numbered. I know how to insert the page numbers using the master pages, but they always start right at page 1. The first 8 pages are going to be a table of contents and need their own separate roman numeral page numbers.
    So pages 1-8 need to be labled I-VIII
    and pages 9 - whenever need to be labled 1 - whenever
    Is there a way to do this, or am I going to have to label each individual page?

    You can create a new section starting on page 9. In the page panel select page 9, right click, choose Numbering and Sections Options/Start Page Numbering at 1. It will probably warn you that 1 already exist. Click OK. Now select the first page of the document, right click, Star Page Numbering at 1, Style and choose the roman numerals.

  • Workaround solution for page number problem in books to PDF

    I needed to create a spiral-bound book from Aperture, and decided to print to PDF to create a master rather than going through the online ordering option. Discovered the page numbers were always missing or jumbled whether I used the Automatic or Always On page number settings, even through they were displayed in Aperture correctly. In the final preview before printing to PDF, they become corrupted and no longer display correctly.
    To workaround this problem:
    1. Turn the Page Numbers option to Off in Aperture. (This option is located in the pull-down menu of the Gear icon under the pages thumbnails.)
    2. Print to PDF without any page numbers.
    3. Open your PDF in Adobe Acrobat Professional (to have write priveledges.)
    4. From the Document option in the top bar, Add Headers and Footers.
    5. Click the Footer tab, to add page numbers.
    NOTE: If you want to change the format of your page numbers on odd and even pages for a two page spread, you have to add them in two different passes. For example, insert page number in left column, then repeat action to insert page number in right column only while enabling replacement of existing page numbers. You can choose to start page numbering on any page.
    7. Save your PDF, and you can have it printed wherever you want.
    G5 dual quad   Mac OS X (10.4.7)  
    G5 dual quad   Mac OS X (10.4.7)  

    Hi,
      Use the window type as FINAL WINDOW, then your problem will be solved.
      Double click on the window and change the window type to FINAL.
    Reward if it is helpful.

  • How do i add page numbers to an existing document

    how do i add page numbers to an existing document

    Not sure if you want to add page number in the footer of the page or want to reset numbering in the page thumbnail view, so I am giving you video tutorial link for both the methods.
    1. Header-Footer method.
    http://tv.adobe.com/watch/learn-acrobat-9/adding-headersfooters-to-your-pdf-documents/
    2. Adding Page number
    http://tv.adobe.com/watch/acrobat-x-tips-tricks/quick-tip-how-to-add-page-numbers-to-a-pdf -file/

  • LibreOffice Writer - Add Pages NumbersStart it from a Different page

    Hi guys.
    I'am trying to add page number in different page in Libreoffice. I found video in http://youtu.be/mEZWcAimocw. But when i'am type -1 in field section i've got zero in footer page number.
    http://i6.pixs.ru/storage/4/2/2/snapsho … 904422.png
    Thanks for helping me with this issue

    Yeah, it seems that if you use an offset like -3, it will show 0 at the third page. While it should start with the number 1 on page # 4.
    That's a bug. And it's being ignored by the automatic index generated by libreoffice if I may believe the comments.
    You should try the voted answer here: http://stackoverflow.com/questions/1104 … number-bug
    EDIT: I don't think that FOSS + Office suit = Good working combination. Office 2007 works fine under wine.
    Last edited by Rexilion (2014-04-30 09:11:02)

  • Page number, in a table, in footer

    Hello,
    I'm having an issue which I think might be a legitimate bug. Here's the probem:
    • I'm adding the dynamic "page number", into a table, that resides within the footer.
    • When the page number reaches double digits (10, 11, etc), the number displays as two digits, but the spacing is being treated like a single character.
    So, when you hit "10" the zero overlaps any text that comes after the number. You can add extra spaces to make up for this issue, but then the previous, single digit, pages are all messed up. They have way to much spacing now.
    I've tried everything I can think of and still can't get around this issue. Starting a brand new document, removing all formatting, etc. I'm hoping someone has run across this before and knows of a solution, or maybe an update to fix this in Pages (Fingers crossed..haha).
    Any help or comments is appreciated.
    Thanks,
    Josh

    Hi Jerry,
    I've saved a screen shot of my existing working document as well as a brand new blank document to show that it's not my styles that's causing the issue. You will notice that the "10" page number is overlapping the text that follows it. When you highlight the "10" only the "1" get's highlighted, which makes me think it's representing that number incorrectly as a single digit.

  • How to add page numbers (centred) at the foot of a page?

    Even this is confusing!
    I typed my question hit return and was told I couldn't post a blank message.
    How do I post my message?
    I simply want to know how to add a page number at the foot (centred) of a page.
    Oh! Great! Now I see, I should have known to scroll way down to find "post message".
    Anne

    What kind of document: word processing? Spreadsheet? something else?
    What program are you using to create the document?

  • Add name and page number to document

    Is there a built in way to add your name and page number to each page in a pages document?

    Hi Faynus! You can put it in the header or footer. Use Insert Page number in the menu. You need to have the insert point in the footer if you want it there. you can get the PAges User Guide by going to the menu > Help > Pages User Guide. YOu have the info about headers and footers there

Maybe you are looking for

  • Help With JScrollPane and many JLabels...

    I am in the process of designing an 'image browser' applet for a client, but am having some difficulty in deciding how I can most elegantly meet all of the requirements. The specification calls for an applet that can view up to 400 images (all images

  • Jar files and class path

    I have a small swing application which connects to an external database and queries something and creates a small report on the local machine. Running from the command line calling the == java MyClass works good. I would like to deploy this to two ot

  • Zen Vision:M track list

    I looked through other threads and didn't see an exact answer to this. My Vision:M wants to list all songs alphabetically. Even when I play an individual album without using playlists, the songs on each album are listed alphabetically. Can this be ch

  • How to create a transport for SAPscript form

    Hi Gurus, Good day! I would like seek an expertise from you guys on how i'll be able to create a transport for the SAPscript form. The form has already been copied from the other boxes by running the program RSTXSCRP. Appreciate your help. Thanks in

  • How do I invoke the J2EE Engine (what path)

    Hello: I isntalled the SAP WebAS Sneak Preview (NOT the ENTERPRISE PORTAL, whcih I could never get to work). In the Enterprise portal install, it puts the J2EE Admin tool in the /usr/.... path. That path is not created in the WebAS Sneak Preview Inst