sending text file as attachment to a an email

Dylan Snyder

Registered User.
Local time
Today, 17:20
Joined
Dec 31, 2007
Messages
89
I currently have access set up to attach a generated excel report to an email and send. As a supplement to the report, I would like to attach a text file that explains in greater depth the report. I can't place this info in the body of the email becuase I only want it sent to those who receive the report in excel form. The following is the code to send the report. Any suggestions?

Dim email As String
Dim email_Subject As String
Dim email_text As String
Dim buyer As String

email = Me.Email_Address
buyer = Me.Buyer_ID

email_Subject = Me.Vendor_Name + " - New_Changed Orders for Buyer -" + buyer
email_text = "The attached report only contains Newly Created Purchase Orders and Purchase Orders that have been changed. Please send questions to the attention of xxxxxxx@xxxxxxx.com. Please confirm receipt of email."

If Me.Format_to_Receive_PO_Information = "RTF" Then
DoCmd.SendObject acReport, "V10 - Send New_Changed Information to Vendor", "RichTextFormat(*.rtf)", email, "xxxxxx@xxxxxxx.com", "", email_Subject, email_text, True, ""
End If
If Me.Format_to_Receive_PO_Information = "XLS" Then
DoCmd.SendObject acReport, "V10 - Send New_Changed Information to Vendor", "MicrosoftExcelBiff8(*.xls)", email, "xxxxxx@xxxxxxx.com", "", email_Subject, email_text, True, ""
End If
 
thanks, automating outlook looks way over my head. what about this-- would it be possible to define an alternate email text, like email_text_2 and then reference that for the email body for the excel report recipients?
 
Don't sell yourself short - The entire pc of code was in post 7 :)
 
thanks, I have it pasted into the code. All I need now is Outlook objects library. How do I get it? It's not listed as an add-in in the menu.
 
In the code editor do tools-> references... It should be listed there. Do you understand the whole library thing?
 

Users who are viewing this thread

Back
Top Bottom