Mail Merge program to run in Batch Mode RRS feed

  • Question

  • Everyone,

      I have a 5 MS Word Mail Merge modules and I want to be able to run these in a batch mode via vb script.  Each *.docx program has their won Excel file to go against. 

    1.  When I start the program, it asks me about the 'select * from SHEET1' statement and I click yes. 

    1A.  I want to execute this job in batch from the command line and not get this line.

    2.  Then I go to Mailings -> Select Recipients -> Use an Existing List and point to the Excel spreadsheet I want to use.

    2A.  In the vba script I want to name the datasource to be the excel file I want to go against.

    3.  Then I click on the macro I wrote to save each page as a pdf document and use one of MERGEFIELDs and some other fields from the input file name to create the output file name.

    3A. I want to use this macro to create the PDF output files.

    4.  Then I would be done with this file.  I know I would have to create a FOR loop to reach mall of the files in the folder and for each one *.docx, then I want to execute the steps 1-3 from above.

    5.  What is going to make this even more interesting is to have another folder with 8 mail merge documents in there.  Then when I complete these first 5, then go to that folder with 8 of them and then process those 8 files.

      Yet, any direction on getting this done would be greatly appreciated.  Thanx in advance.

    Thursday, October 25, 2018 8:49 PM

All replies

  • Hi ballj_351,

    Thanks for visiting our forum.

    Then here we mainly focus on general issues about Word desktop client. Since your query is more related to developing, I'll move your thread to the dedicated MSDN forum for Word for better response:

    The reason why we recommend posting appropriately is you will get the most qualified pool of respondents, and other partners who read the forums regularly can either share their knowledge or learn from your interaction with us. Thank you for your understanding.


    Yuki Sun

    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact

    Click here to learn more. Visit the dedicated forum to share, explore and talk to experts about Microsoft Teams.

    Friday, October 26, 2018 9:40 AM
  • Hi Ballj,

    The second step also uses VBA to implement?

    Best Regards,


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread.

    Monday, October 29, 2018 10:21 AM