Question

Locked

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")
objMailItem.Display
End sub

This conversation is currently closed to new comments.

0 total posts (Page 1 of 1)  
Thread display: Collapse - | Expand +

All Answers

Share your knowledge
Back to Windows Forum
0 total posts (Page 1 of 1)  

Related Discussions

Related Forums