J
John
Hi
I am using the below code to generate an outlook message from a template
from within access. I am getting the 'Object variable or With block variable
not set' error on the line indicated. What am I doing wrong?
Thanks
Regards
Dim OutlookApp As New Outlook.Application
Dim em As Outlook.MailItem
Dim objOutlookRecip As Outlook.Recipient
em = OutlookApp.CreateItemFromTemplate(Template) '<== This line gives the
error.
With em
em.Recipients.Add ("(e-mail address removed)")
em.Recipients.Add ("(e-mail address removed)")
.Subject = "My Subject"
.Body = "Body Text"
.AttachmentAdd "c:\fiewlname.txt"
.Display (False)
End With
Set em = Nothing
I am using the below code to generate an outlook message from a template
from within access. I am getting the 'Object variable or With block variable
not set' error on the line indicated. What am I doing wrong?
Thanks
Regards
Dim OutlookApp As New Outlook.Application
Dim em As Outlook.MailItem
Dim objOutlookRecip As Outlook.Recipient
em = OutlookApp.CreateItemFromTemplate(Template) '<== This line gives the
error.
With em
em.Recipients.Add ("(e-mail address removed)")
em.Recipients.Add ("(e-mail address removed)")
.Subject = "My Subject"
.Body = "Body Text"
.AttachmentAdd "c:\fiewlname.txt"
.Display (False)
End With
Set em = Nothing