Hi,
I'm trying to send report called "Harmonogram" as attachment in e-mail. I don't want to use send object method because sometimes I need to sent more files as attachment. Here is the code I use:
I have found this code on Internet but there is a problem in line: .Attachments.Add thereport, olByReference, 1, "Harmonogram". It shows me an error message: Data type conversion error. - 3421. Any ideas?
Thank for help.
I'm trying to send report called "Harmonogram" as attachment in e-mail. I don't want to use send object method because sometimes I need to sent more files as attachment. Here is the code I use:
Code:
Dim objOutlook As Outlook.Application
Dim objEmail As Outlook.MailItem
Set objOutlook = CreateObject("Outlook.application")
Set objEmail = objOutlook.CreateItem(olMailItem)
Set thereport = CurrentDb.OpenRecordset("Harmonogram")
Email = Me.Email
With objEmail
.To = Email
.Subject = Harmonogram
.Body = text
.Attachments.Add thereport, olByReference, 1, "Harmonogram"
.Display
End With
Set objEmail = Nothing
I have found this code on Internet but there is a problem in line: .Attachments.Add thereport, olByReference, 1, "Harmonogram". It shows me an error message: Data type conversion error. - 3421. Any ideas?
Thank for help.