Solved

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

Posted on 2009-05-07
4
1,510 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Most if not all databases provide tools to filter data; even simple mail-merge programs might offer basic filtering capabilities. This is so important that, although Access has many built-in features to help the user in this task, developers often n…
Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …

920 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now