1

I want to automatically send emails through Outlook. It gets as far as myAttachments.Add and states:

Object doesn't support this property or method.

I've tried this a few different ways, but errors continue on the attachment section. All other sections work creating the email.

What am I doing wrong?

Sub Send_Emails() Dim OutlookApp As Outlook.Application Dim OutlookMail As Outlook.MailItem Dim myAttachments As Outlook.Attachments Set OutlookApp = New Outlook.Application Set OutlookMail = OutlookApp.CreateItem(olMailItem) Set myAttachments = OutlookMail.Attachments myAttachments.Add Source:=ThisWorkbook, Type:=olByValue With OutlookMail .BodyFormat = olFormatHTML .HTMLBody = "Attached is the Transaction Report" .To = "[email protected]" .Subject = "Transaction Report" .Send End With End Sub 

1 Answer 1

1
With OutlookMail .To = "[email protected]" .Attachments.Add ThisWorkbook.fullName .Display End With 
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.