Transfer Spreadsheet and attach to e-mail

stavros

New member
Local time
Today, 07:59
Joined
Dec 11, 2012
Messages
4
Hi,

from my current database i can run a report which will produce an e-mail with an attached word document so i can send off to my customers.

Private Sub Command90_Click()
On Error GoTo Errhandler
Stremail = DLookup("Email", "Customer List", "Customer = '" & Forms!DataInput![Reseller Name] & "'")
DoCmd.SetWarnings False
DoCmd.SendObject acSendReport, "Appointment Info Report", acFormatXLS, Stremail, , , "Daily Order Status Report Pack", _
"Dear " & Me.Reseller_Name & Chr(10) _
& Chr(10) _
& "Please find attached information recent order activity. Please go through the standard channels if you have any queries or issues." & Chr(10) _
& Chr(10) _
& "Kind Regards," & Chr(10), True

I now want to produce the same document in .XLS format so that i can add further fields and expand what information i provide.

I have created the following and it saves a .XLS document to my desktop and i have formatted it so it looks better.

User = Environ("Username")
Stremail = DLookup("Email", "Customer List", "Customer = '" & Forms!DataInput![Reseller Name] & "'")
DoCmd.SetWarnings False
DoCmd.TransferSpreadsheet acExport, , "Intro Query", "C:\Users\" & User & "\Desktop\Forecasting Report.xls"

I want to incorporate the clicking of the button to produce the .xls docment and also attach it to an outlook email ready to be sent.

can someone help me piece these 2 codes together? its been driving me :banghead:

thanks
Paul
 
Last edited by a moderator:

Users who are viewing this thread

Back
Top Bottom