From Access to Word.docx to PDF to Outlook

Gijs

Registered User.
Local time
Today, 00:54
Joined
Oct 22, 2012
Messages
15
Hi there,

I'am struggling for a while to write some code for sending an e-mail (Outlook) from an Accessform, with a PDF attachment constructed with information from the same Accessform.

Does anybody knows if this is even possible? I'am stuck at creating the pdf file for the docx file.

Please help...
 
Welcome to the Forum,

First create an Access Report that mirrors the information you want to send as a PDF document based on the Access Form. You then set to open the report/print it based on the id field so it is just the one record then you can save/output the Report as a PDF then use the VBA code to start an Outlook email with the attachment.

Create a macro to open the report which can then be converted to VBA

Email Code is as follows:

Sub sendForApproval()
'*************************************************
'VBA Code created by Trevor G November 2009
'Set the Reference to use Outlook, Tools Menu and References
'*************************************************
Dim olApp As Outlook.Application
Dim olMail As MailItem
Set olApp = New Outlook.Application
Set olMail = olApp.CreateItem(olMailItem)
With olMail

.To = whoitgoesto@address
.Subject = "File"
.Body = "Please find the file attached"
.Attachments.Add "M:\File Location and name.pdf"
.Display 'or use .Send once you have it working

End With
Set olMail = Nothing
Set olApp = Nothing
End Sub
 
Thanks Trevor. I'am going to try this.
 

Users who are viewing this thread

Back
Top Bottom