Outlook 365 Macro

By Clay.Sanker ·
Tags: Windows, Software
I'm trying to create a macro in Outlook 365 that will attach specific docs to an open email(either new or a reply). I've found various macros that will do that but they all start a new emails as opposed to attaching to one I alreay have opened. I have the below script that I've tried to make work but it too creates a new email. All attachments are either PDF or Word format. I'm new to macros in Outlook and would appreciate any help you can give.

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>"

Set objOutlookAttach = objMailItem.Attachments.Add("P:\Telecom\Avaya\Manuals\9611 user guide.pdf")
Set objOutlookAttach = objMailItem.Attachments.Add("P:\Telecom\Avaya\Manuals\Avaya_IP_Imp_Guide.pdf")
End Sub

This conversation is currently closed to new comments.

Thread display: Collapse - | Expand +

All Answers

Share your knowledge

Related Discussions

Related Forums