Solved

Access 2007 use VBA to Send Report as a PDF attachment to Outlook without Security Msgs

Posted on 2009-05-07
4
1,513 Views
Last Modified: 2012-08-14
Hello

I need to email out a bunch of statements to different recipients
I started using    DoCmd.SendObject acSendReport, rptName, acFormatPDF, Recipient etc
But I get the security messages from Outlook that I don't want the user to see.

So I am now trying a different approach
I am OK using VBA code to send an email with an attachment using something like
    Set appOutLook = CreateObject("Outlook.Application")
    Set MailOutLook = appOutLook.CreateItem(olMailItem)
     With MailOutLook
        .To = Recipient
        .subject = subject
        .Body = message
        .Attachments.Add (attach_file)
        .Save
        .Send
     End With
etc

But I can't quite work out how to get the report as a PDF to attach to the email
This may be the simple  part but just can't see it

A bit of code would be lovely!

Many thanks

0
Comment
Question by:stillers1994
  • 2
  • 2
4 Comments
 
LVL 22

Accepted Solution

by:
Kelvin Sparks earned 500 total points
ID: 24331114
You first need to create the pdf.

DoCmd.OutputTo acOutputReport,rptname,acFormatPDF,outputfile,False

Where you create the pdf file - outfile would be the full file path.

Then use .Attachments to attach that file (delete it after if you need).

You will find, however, that the Outlook security message will still get in the way, and I'd be keen to see if anyone else has a simple answer to that. Are you using a local Outlook, or part of an Exchange mmailserver type of setup?

Kelvin
0
 

Author Comment

by:stillers1994
ID: 24331228
Hello Kelvin
Thankyou for your quick reply
I believe they will be using a local Outlook.
I just want to get rid of those security messages
If this method doesn't do that then I suppose you have saved me the trouble of continuing down that route (and answered my question)
Does anyone have the solution of avoiding the security messages?
Or do I have to open a new question?
0
 
LVL 22

Expert Comment

by:Kelvin Sparks
ID: 24331248
Had a quick look on EE

There are a number of questions relating to that with various solutions.

Local Outlook is possibly easier to manage.

Kelvin
0
 

Author Closing Comment

by:stillers1994
ID: 31579228
I guess your answer is as per my question.
I had a good look on EE before but couldn't quite find the answers. I will look again and mayb re-phrase my question
Many thanks
0

Featured Post

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
How Can I Grab This Information off a PDF Form 23 49
Access 2016 7 35
Normalization of a table 19 75
SQL Group on First occurrence 9 26
When you are entering numbers in a speadsheet, and don't remember what 6×7 is, you just type “=6*7" instead. It works in every cell! This is not so in Access. To enter the elusive 42 in a text box, you have to find a calculator, and then copy the re…
Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question