Consulting

Results 1 to 3 of 3

Thread: Wait while word is printing

  1. #1
    VBAX Newbie
    Joined
    Apr 2010
    Posts
    4
    Location

    Question Wait while word is printing

    I have a Word document which creates a final document based on the records from access 2003 using mailmerge. I'm having problems with the printing to PDF. After debugging, I saw that because of the following code, the printing is occurring SLOWLY (~2pg/min). Some documents can be 300 pages long. I'm using this code to just tell the VBA code to wait until Word is finished printing the document to a PDF. Is there a better way to do this?

    [VBA]
    '-- Execute the mail merge
    objWordDoc.MailMerge.Execute Pause:=False

    'THIS IS WHERE IT TAKES A LONG TIME.
    If objWordApp.Options.BackgroundOpen = True Then
    'While jobs in queue
    While objWordApp.BackgroundPrintingStatus
    DoEvents
    Wend
    While objWordApp.BackgroundSavingStatus
    DoEvents
    Wend
    End If
    [/VBA]

  2. #2
    VBAX Master CreganTur's Avatar
    Joined
    Jan 2008
    Location
    Greensboro, NC
    Posts
    1,675
    Location
    I have an application that does the same thing- printing mail merge docs based on access records. The difference is that I don't have any code to keep the database from doing anything while it's printing. The user's printing screen just has very limited functionality and they've been trained not to do anything else with the database until printing is complete.
    -Randy Shea
    I'm a programmer, but I'm also pro-grammar!
    If your issue is resolved, please use Thread Tools to mark your thread as Solved!

    PODA (Professional Office Developers Association) | Certifiable | MOS: Access 2003


  3. #3
    VBAX Newbie
    Joined
    Apr 2010
    Posts
    4
    Location
    Randy,
    Thanks for the quick reply.. My application goes on to do other things after word finishes creating the PDF. It runs other queries and clears out tables which the word document looks for and then archives those records.. So I have to wait for the mailmerge to finish or else the records that it's reading from the tables would get cleared and moved.

Posting Permissions

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