Consulting

Results 1 to 20 of 49

Thread: Need code to merge PDF files in a folder using adobe acrobat X

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    VBAX Contributor
    Joined
    Dec 2009
    Location
    Sevastopol
    Posts
    150
    Location
    Quote Originally Posted by yuechu View Post
    I browsed for Acrobat.tlb, but when the macro ran, it kept displaying that it cannot insert page from this line: MsgBox "Cannot insert pages of" & vbLf & p & a(i), vbExclamation, "Canceled"
    Hi and welcome to VBAX!

    You can't insert new page after the PDF document with password protection has been inserted.
    Have a look on protection property of the last document inserted into the resulting file MergedFile.pdf

    Regards
    Last edited by ZVI; 07-10-2014 at 04:22 PM.

  2. #2
    VBAX Newbie
    Joined
    Jul 2014
    Posts
    4
    Location
    Thanks ZVI. I see that the file does have password protection in it even though it does not ask for any when I open it. I tried it with some PDFs I created and the macro worked perfectly.

    My next steps will be to only merge similar PDF files (files beginning with same filenames) out of the bunch of PDF file in the folder and then renaming the merged file to a corresponding name on a list. Any tips of the best way to do that?



    Quote Originally Posted by ZVI View Post
    Hi and welcome to VBAX!

    You can't insert new page after the PDF document with password protection has been inserted.
    Have a look on protection property of the last document inserted into the resulting file MergedFile.pdf

    Regards
    Last edited by yuechu; 07-11-2014 at 05:44 AM.

  3. #3
    VBAX Contributor
    Joined
    Dec 2009
    Location
    Sevastopol
    Posts
    150
    Location
    Quote Originally Posted by yuechu View Post
    ...My next steps will be to only merge similar PDF files (files beginning with same filenames) out of the bunch of PDF file in the folder and then renaming the merged file to a corresponding name on a list. Any tips of the best way to do that?
    Name of the destination file is defined in the constant DestFile of the subroutine Main(), change it as required.
    Or pass file name you like into the sub MergePDFs() using the 3-rd parameter.

    To merge some files in a folder by filename mask replace this f = Dir(MyPath & "*.pdf")
    for example by that one f = Dir(MyPath & "MyFileMask*.pdf")

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •