Solved

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

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

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Join & Write a Comment

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…
It took me quite some time to sort out all the different properties of combo and list boxes available from Visual Basic at run-time. Not that the documentation is lacking: the help pages are quite thorough and well written. The problem was rather wh…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

757 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

18 Experts available now in Live!

Get 1:1 Help Now