Consulting

Results 1 to 2 of 2

Thread: Need Macro to Rename and Combine Word Documents

  1. #1
    VBAX Newbie
    Joined
    May 2019
    Posts
    1
    Location

    Need Macro to Rename and Combine Word Documents

    Hi All,

    I have 2 folders of PDF files that are exported from SAP. One folder is invoices and the other folder is the packing lists. The files are all named random spool numbers so they do not match up whatsoever.

    I found a macro code here that will rename the files to the document numbers found within the files themselves after I've done batch conversions from PDF to DOC format for both folders but they are renamed using RTF format when I use the renaming macro.

    What I need next is to be able to merge the matching documents from each folder into a new folder of new documents. Essentially, I need to append the document from folder 2 to the next page of the corresponding (same named) document in folder 1. Once I have them merged I can batch convert back to PDFs. Any ideas and THANK YOU.

    Eg.

    Folder 1

    ABC.rtf
    DEF.rtf
    GHI.rtf

    Folder 2
    ABC.rtf
    DEF.rtf
    GHI.rtf

    New Folder
    ABC.rtf
    DEF.rtf
    GHI.rtf

    If there was a code that could take the randomly spooled PDFs and search them for the document numbers, combine the files that contained matching document numbers, and save as new documents then that would be a win. I've researched everywhere and as far as I've gotten is being able to export the randomly spooled PDFs into two separate folders, batch convert each folder of PDFs to DOC files, then use a macro the search for specific text beginning with "PPHB" and create new RTF files. I'm left with two file folders that have the same two sets of files that need to matched and merged together (1-to-1).

  2. #2
    Knowledge Base Approver VBAX Guru macropod's Avatar
    Joined
    Jul 2008
    Posts
    4,435
    Location
    Quote Originally Posted by ld1551 View Post
    I found a macro code here that will rename the files to the document numbers found within the files themselves after I've done batch conversions from PDF to DOC format for both folders but they are renamed using RTF format when I use the renaming macro.

    What I need next is to be able to merge the matching documents from each folder into a new folder of new documents. Essentially, I need to append the document from folder 2 to the next page of the corresponding (same named) document in folder 1. Once I have them merged I can batch convert back to PDFs.
    Since you haven't posted the code - or even a link to it - no one here can tell you what changes you need to make.
    Cheers
    Paul Edstein
    [Fmr MS MVP - Word]

Posting Permissions

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