Active TopicsActive Topics  Display List of Forum MembersMemberlist  Search The ForumSearch  HelpHelp
  RegisterRegister  LoginLogin
PDF reDirect Pro Beta
 EXP Systems Forum : PDF reDirect : PDF reDirect Pro Beta
Topic: Batch e-mailing Post Reply Post New Topic
Author Message

Joined: 27 Nov 06
Location: Netherlands
Posts: 2
Quote afix Replybullet Topic: Batch e-mailing
    Posted: 27 Nov 06 at 3:31AM
Wow, what a nice utility and what a great support! Exactly what I need! Clap
I am using it to create PDF files from MS Access reports which I would like to send by e-mail automatically. I have reviewed and customized the MS Access sample, but cannot figure out how the batch printer decides whether to just create the file, FTP or e-mail it. An action option seems to be missing? I have noted the remarkt that it is better to first create the file and then send it manually, but does that still apply?
IP IP Logged
Moderator Group
Moderator Group
Forum Administrator

Joined: 25 Jan 03
Posts: 1673
Quote Michel_K17 Replybullet Posted: 27 Nov 06 at 10:45PM
Hi Afix,

   You are welcome! Smile

   To answer your question: the e-mail will be sent if the list of e-mail addressees (TO and/or CC) is not empty. If both the "TO" and "CC" lists are empty, than nothing is sent. Please note that the sample VBA code has the e-mail section commented out. Therefore, if you had already preset an e-mail when you setup the Batch printer in the program, than that e-mail would always be sent unless you override the settings in VBA.

   The way to think about it is: changing the settings with the VBA code is the same as making the changes manually through the user interface.

    The action option is done when you decide to print. Therefore, to summarize:

    1. Get the settings
    2. Change them as required
    3. Save the settings
    4. Print to the Batch printer (which will use the settings you set at step 2)
    5. Batch printer does it's magic, including sending the e-mail(s)

    The comment about sending it manually is true. It would give you better control. I went back to the sample code, and I see that I put the code for the manual FTP upload, but that I forgot to add the manual e-mail code which would allow you to e-mail the PDF manually after it has been created. My fault (sort of). I can add the SMTP e-mail function fairly easily, but the MAPI e-mail will require more work (but it is not impossible).

    Another way to ensure that the flow goes well would be to turn on the progress window, and then look for that printer window which will be displayed while the e-mails are being sent. Once the printer window disappears, then it would be safe to print and send the next e-mail. Basically, you would have to use the "FindWindow" API call:

Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long

    then, in the VBA Code:

    'Search for the BatchPDF window
        WinWnd = FindWindow(vbNullString, MyBatchPrinter)
    Loop While WinWnd <> 0

    ' Batch Printer Window is now closed
    ... continue here

    Of course, HUGE WARNING, in that the code above will set yourself up for an infinite loop, so you'll want to setup a timer or a counter so that your program gives up after X minutes. I've added the Do Events so that at least you can pause the code and quit without having to force the application down.

   I hope that helps!

Michel Korwin-Szymanowski
EXP Systems LLC
IP IP Logged

Joined: 27 Nov 06
Location: Netherlands
Posts: 2
Quote afix Replybullet Posted: 30 Nov 06 at 6:12PM
Thanks for the response. At the moment I am very busy on another part of my application, so I haven't been able to try your suggestions yet. If you have time I would be very happy with the manual e-mail code.
IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum