Knowledgebase: Developer
Problem using the Win2PDF Mail Helper to batch email PDF files
Posted by Craig Lebakken on 24 October 2007 07:38 PM
Problem:
When sending PDF files in a batch process using the Win2PDF Mail Helper, some PDF files are attached to the wrong email.

Solution:
The problem occurs because the Win2PDF Mail Helper sends email asynchronously. When the next print job in a batch is started, it may overwrite the PDF file before the Mail Helper sends the previous PDF file.

You can avoid the problem by adding a polling loop to wait for the Win2PDF Mail Helper to send the PDF before creating the next PDF file. The following VB code will wait for the Mail Helper to finish:

'wait until the Win2PDF Mail Helper has sent the file
    Do
      result = GetSetting("Dane Prairie Systems", "Win2PDF", "MailHelperResult")
      Sleep (1)
    Loop Until result <> ""

You should also add the following line before the call to "DoCmd.OpenReport":
DeleteSetting "Dane Prairie Systems", "Win2PDF", "MailHelperResult"

This code polls for the Mail Helper status code, which is 0 if the email was sent successfully.
(0 vote(s))
Helpful
Not helpful

Comments (0)

Copyright 2000-2018 © Dane Prairie Systems LLC. All Rights Reserved. About Us | Privacy Policy | PDF Blog | Site Map