M
muybn
On the line with "objAttach.Add" below, I am trying to make an attachment to
an e-mail created from the Word doc, but it throws the error "Object variable
or With block variable not set," whether in or outside of the "With objItem"
section. Any suggestions?
Dim objOutlookApp As Outlook.Application, objItem As Outlook.MailItem
Dim objAttach As Attachments
Dim objItem As Outlook.MailItem
Set objItem = objOutlookApp.CreateItem(olMailItem)
With objItem
.Save
objAttach = objItem.Attachments
objAttach.Add "C:\Data\misc\jbz\" & strDoc & ".doc"
.BodyFormat = olFormatHTML
.To = strE
.Subject = strDoc
.Display
End With
Set objItem = Nothing
Set objOutlookApp = Nothing
Set objAttach = Nothing
an e-mail created from the Word doc, but it throws the error "Object variable
or With block variable not set," whether in or outside of the "With objItem"
section. Any suggestions?
Dim objOutlookApp As Outlook.Application, objItem As Outlook.MailItem
Dim objAttach As Attachments
Dim objItem As Outlook.MailItem
Set objItem = objOutlookApp.CreateItem(olMailItem)
With objItem
.Save
objAttach = objItem.Attachments
objAttach.Add "C:\Data\misc\jbz\" & strDoc & ".doc"
.BodyFormat = olFormatHTML
.To = strE
.Subject = strDoc
.Display
End With
Set objItem = Nothing
Set objOutlookApp = Nothing
Set objAttach = Nothing