Question

Locked

Add Attachment to Outlook 365 using Macro

By Clay.Sanker ·
Tags: Windows, Software
I'm new to macros but I'm trying to create a specific one but can't seem to make it work. We recently converted to Outlook 365 and I'm trying to create a script that will add specific attachments to an opened email or an email I'm replying to. I came up with the script below that will add attachments but it opens it in a new email. The attachments are either Word or PDF formats and there would be multiple macros based on the different attachments needed. I have found several that do different things but I can't seem to edit them to make them do what I need. Any help would be greatly appreciated. Please let me know if you have any questions.

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