Link to home
Start Free TrialLog in
Avatar of CafeTica
CafeTica

asked on

Automate: insert Access Report (RichText) into Body of Outlook email.

Hello,

I am trying to automate the process of inserting an Access Report (Rich Text) into the body of an Outlook email. Presently, I use an Access macro to create the report as a rich text file and then open the file in Word. Then I copy and paste the rich text from the Word file into the body of my Outlook email. (using OutputTo Macro)

I tried to do automate the process using a SendObject Macro (or VBA Method), however, it only allows me to attach the report as a file rather than insert the rich text report into the body of the email.

How do I automate the insertion of an Access Report into the body of an Outlook email from Access?

Thank you
SOLUTION
Avatar of Berkson Wein
Berkson Wein
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
You can do a test first by sending the Word doc created from the RTF report manually, by selecting Send as Email from the Save & Send option in Word 2010, or File, Send To, Mail Recipient in Word 2003.  This will make the Envelope pane appear, where the email address is entered for sending the document.
Avatar of CafeTica
CafeTica

ASKER

Thanks for the suggestion. I want to avoid complicated coding to keep things as easy as possible for anyone else who wants to make changes to the database.

Intuitively, it seems strange that there isn't an easier solution. It's as close as cutting and pasting. IOW Access already took me 99.99999% of the way there. It can generate a Word file with the exact right formatting (OutputTo) and it can generate an email (SendObject) with everything I want except placing the report into the body of the email.

Basically, it's "that" close and I'd hate to go a complicated coding route to do just one last thing.
You would need to write code to save the report in RTF format, then open it in Word, then use code from my code sample to open the Envelope pane and fill in the subject and email address.
Actually, the coding that opens and fills the Envelope pane is pretty simple -- my code sample does a lot more, but you may only need a small portion of it.
If you post your code, I could modify it to use the Envelope object to send the RTF Word doc.
I've gotten a lot of good suggestions here that I won't be using. The answers helped me to understand the level of complexity necessary to complete the task and make the decision to NOT pursue automation. Consequently, what is the proper way to distribute the points/accepted answers?

Thanks