How to email a pdf document via VBA in access

I have my report in access which i want to be sent as a pdf, am using cute pdf writer to convert it to a PDF now i need a function which will attatch the pdf into an email so the user clicks the button to email then it user cute pdf writer to convert then attatches the created pdf to an email, any assistance would be great. Thanks
mikkykiloAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

mikkykiloAuthor Commented:
Hey found soloution on my own so do not need help with this qestion any more, thnks anyway, not sure how to remove question though.
0
mikkykiloAuthor Commented:
And for those who are curious, this is the code i used.
This created the pdf using cute pdf ceator, and waits for ok then emails report.
   stDocName = "rptInvoice"
   Set Application.Printer = Application.Printers("CutePDF Writer")
   DoCmd.OpenReport stDocName, acViewNormal
   Application.Printer = Nothing
   MsgBox ("Press ok once pdf is created")
Dim objOutl
Set objOutl = CreateObject("Outlook.Application")
Set objMailItem = objOutl.CreateItem(olMailItem)
'comment the next line if you do not want to see the outlook window
objMailItem.Display
'strEmailAddr = "me.me@you.com"
'objMailItem.Recipients.Add strEmailAddr
objMailItem.Body = "Please see attatched invoice."
objMailItem.Attachments.Add "i:\DNR_Database\invoicetemp\invoice.pdf"
'objMailItem.Send
Set objMailItem = Nothing
Set objOutl = Nothing
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Jeffrey CoachmanMIS LiasonCommented:
mikkykilo,

I used to use Cute PDF as well.

And perhaps this functionality could have been easilly achieved.

I now use this instead:
http://www.lebans.com/reporttopdf.htm

This problem with your request is that:
1. After your code is run it will have created a PDF from the report, even it the PDF file existed already.
It will also create a new PDF for the same Report over and over again, for the same report, each time you click the button.

Here is a sample anyway, to get you started.

Notes:
You will have to get a program to bypass the Outlook security pop-up.
ClickYes:
http://www.contextmagic.com/express-clickyes/
Outlook Redemption:
http://www.dimastr.com/redemption/

You will also need to load the Outlook library in VBA.

JeffCoachman
Access-BasicConvertReportToPDFAn.mdb
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.