Solved

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

Posted on 2009-05-07
4
1,521 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

632 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