Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Exporting to Ms Outlook 2

Status
Not open for further replies.

hirenJ

Programmer
Dec 17, 2001
72
GB
Hi Guys, Ive got a bit of a bastard on my hands, can anyone help?

Im trying to export a table of data from an access application into an outlook email attachment -- does anybody know how?

I can manage to send emails from the app, but how do I transfer a table of data into the email attachments section?
Is this possible?


Thanks

Hiren

:eek:)
 
Hiren,

Put this in an appropriate event in your code. You will need a reference to the MS Outlook object library.

Dim objOutlook As Outlook.Application
Dim objOutlookMsg As Outlook.MailItem
Dim objOutlookRecip As Outlook.Recipient
Dim datFile As Date
Dim datDate As Date
Dim intWeekday As Integer
Dim strMessageBox As String
Dim strMessageBoxTitle As String

DoCmd.OutputTo acOutputReport, "ReportName", "Rich Text Format (*.RTF)", "Attachment Path", False, ""
'Repeat this line for all your queries

'Create Outlook Session
Set objOutlook = CreateObject("Outlook.Application")

'Create message
Set objOutlookMsg = objOutlook.CreateItem(Outlook.olMailItem)

'Set attributes for message
With objOutlookMsg
Set objOutlookRecip = .Recipients.Add(Enter email address here)
objOutlookRecip.Type = Outlook.olTo
.Subject = "Subject"
.Attachments.Add "Attachment Path" OlByValue
.Save .Send End With

Craig
 
thats great -- its runs so sweetly!! Thankyou so much!!


Hj

:eek:)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top