Results 1 to 13 of 13

Thread: Combining multiple word documents into one

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1

    Combining multiple word documents into one

    I have some code that prints out multiple word documents. It works, but when we did a full volume test, which is about 2,000 a day, the printer began skipping pieces of documents. We ramped up the memory on the printer, did not work. This VBA code is executed within an Access DB. However, when I execute it from a macro within a word document, it prints properly, but way too slow. So, I want to try to merge all the documents in to one and then try to print that.

    Does anyone know how to do that within the FSO environ. I have been trying for a few hours now.

    Dim wordApp As New Word.Application
        Dim myDoc As Word.Document
        Dim myDoc2 As Word.Document
    wordApp.Visible = False
        wordApp.ScreenUpdating = False
        wordApp.DisplayAlerts = False
    Const TARGET_FOLDER_ONEPAGE As String = "P:\Clients\Vanguard\Finance\testing\onepagedocs\"
        With wordApp
       Set Fso = New FileSystemObject
       Set fldr = Fso.GetFolder(TARGET_FOLDER_ONEPAGE)
       For Each f In fldr.Files
          If Right(f.Name, 4) = ".doc" Then
             Set myDoc = Documents.Open(TARGET_FOLDER_ONEPAGE & f.Name)
             myDoc.PrintOut
             myDoc.Merge
             myDoc.Close False
          End If
       Next f
           wordApp.Quit
           End With


    I had the screenupdating off to try to minimize overhead. If anyone can show me how or point me in the write direction, it would be greatly appreciated. Thanks.
    Last edited by Aussiebear; 04-12-2023 at 06:04 PM. Reason: Adjusted the code tags

Posting Permissions

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