Arcadia
04-07-2014, 03:43 AM
I'm trying to compose a mailt with the form information as attachment like you can see in the code below but i keep getting this error, can someone see what i'm doing wrong? :crying:
11523
With the following highlited in yellow:
Set olMail =
Private Sub Command19_Click()
Set fso = CreateObject("Scripting.FileSystemObject")
Set olObj = GetObject(, "Outlook.Application")
Set olMail = olObj.CreateItem(olMailItem)
olMail.Subject = "Training"
olMail.Importance = "2"
olMail.To = ""
olMail.CC = ""
olMail.BCC = ""
olMail.HTMLBody = "Here comes the body"
Email_Subject = "Subject"
olMail.Display
On Error GoTo debugs
Set Mail_Object = CreateObject("Outlook.Application")
Set Mail_Single = Mail_Object.CreateItem(0)
With Mail_Single
.Subject = Email_Subject
.To = Email_Send_To
.CC = Email_Cc
.BCC = Email_Bcc
.Body = Email_Body
.Send
'acFormatpdf will export the result of query into pdf format and will add the pdf as attachment
DoCmd.SendObject acSendForm, “sales_detail”, acFormatPDF, mailto, ccto, bccto, mailsub, emailmsg, True
End Sub
11523
With the following highlited in yellow:
Set olMail =
Private Sub Command19_Click()
Set fso = CreateObject("Scripting.FileSystemObject")
Set olObj = GetObject(, "Outlook.Application")
Set olMail = olObj.CreateItem(olMailItem)
olMail.Subject = "Training"
olMail.Importance = "2"
olMail.To = ""
olMail.CC = ""
olMail.BCC = ""
olMail.HTMLBody = "Here comes the body"
Email_Subject = "Subject"
olMail.Display
On Error GoTo debugs
Set Mail_Object = CreateObject("Outlook.Application")
Set Mail_Single = Mail_Object.CreateItem(0)
With Mail_Single
.Subject = Email_Subject
.To = Email_Send_To
.CC = Email_Cc
.BCC = Email_Bcc
.Body = Email_Body
.Send
'acFormatpdf will export the result of query into pdf format and will add the pdf as attachment
DoCmd.SendObject acSendForm, “sales_detail”, acFormatPDF, mailto, ccto, bccto, mailsub, emailmsg, True
End Sub