Knowledgebase: Developer
VB Example to Send Email with No User Interaction from Access
Posted by admin admin on 22 November 2006 09:39 PM
Problem:
Do you have any sample code showing how to send email without user interaction from Microsoft Access?

Solution:
The following sample shows how to email without user interaction using the Win2PDF Mail Helper application. You need to install and configure the Win2PDF Mail Helper application before running this code:


The SaveWin2PDFDword routine used in this example is listed on the following page:

http://www.win2pdf.com/doc/usingtheprinterobject.htm


Private Sub cmd_SendReport_Click()
   'This code assumes that Win2PDF is set as the default printer.

Dim stDocName As String
   'enable sending the PDF file with no user interaction
SaveWin2PDFDword "file options", &H420
   'set the output file name
SaveSetting "Dane Prairie Systems", "Win2PDF", "PDFFileName", txt_PDFFileName
   SaveSetting "Dane Prairie Systems", "Win2PDF", "PDFMailRecipients", txt_emailaddress
SaveSetting "Dane Prairie Systems", "Win2PDF", "PDFMailSubject", txt_EmailSubject
SaveSetting "Dane Prairie Systems", "Win2PDF", "PDFMailNote", txt_emailmessage
   stDocName = "rpt_Report_to_EMail"
DoCmd.OpenReport stDocName, acNormal

End Sub
(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