Add Attachment to Outlook 365

By Clay.Sanker ·
Tags: Windows
I am very new to macro's and VBScripts. I'm trying to come up with a macro that will attach specific files to a new email that is already opened or a reply when the macro is executed. Currently I'm using the below script I found but it opens a new email. I just want it to attach a file specified in the macro but not open new. Thank you in advance for your help!

Sub ExistingMessageWithAttachment2()
Const olFormatHTML = 2
Dim objOutlook : Set objOutlook = CreateObject("Outlook.Application")
Dim olMailItem
Dim objMailItem : Set objMailItem = objOutlook.CreateItem(olMailItem)

objMailItem.To = strTO
objMailItem.CC = strCC
objMailItem.Subject = strSUBJECT
objMailItem.BodyFormat = olFormatHTML
objMailItem.HTMLBody = "<HTML><BODY>Test Msg" & "</b><br>" & MySig
Set objOutlookAttach = objMailItem.Attachments.Add ("C:\Temp\Test.pdf")
End sub

This conversation is currently closed to new comments.

Thread display: Collapse - | Expand +

All Answers

Share your knowledge

Related Discussions

Related Forums