• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Macro to attach a file in a shared Outlook draft folder

Outlook version
Outlook 2013 64 bit
Email Account
POP3
#1
Hello. I am trying to do the following. Run a macro in Excel which will attach a file in Outlook (Office 2013) and save in the draft folder of a shared department folder. I will then go to the shared department Outlook account, review the email and click send. I need the email when received by the participant, that the email was sent by "the shared department email account" and not my work email account. I have the current script working but the draft always shows up in my work email account. I have the shared department account setup on my pc and is working properly. Any assistance is greatly appreciated !!

--------------------------------------------------------------------------------------------------------------------

Dim OutApp As Object
Dim OutMail As Object
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
On Error Resume Next
With OutMail
.To = dis_contacts
.CC = cust_contacts
.BCC = ""
.Subject = "Agreement #" & Temp & " PpForm (" & strDistrict & " - " & expr_date & ")" & " Distributor: " & strDistributor & " Customer: " & cust_name
Dim sMsgBody As String
sMsgBody = "Attached is the .................." & vbCr & vbCr
sMsgBody = sMsgBody & "If you need further assistance, please contact " & vbCr
sMsgBody = sMsgBody & "Please do not use the reply function." & vbCr
.body = sMsgBody
.Attachments.Add (dbfile)
.Display

.Save
.Close olPromtForSave
End With
On Error GoTo 0
Set OutMail = Nothing
Set OutApp = Nothing
 
P

Pberlin

#3
you need to set the send on behalf account - right after with outmail, add this:
.SentOnBehalfOfName = "alias@domain.com"
[DOUBLEPOST=1474407269,1474407100][/DOUBLEPOST]Thanks for the quick reply. Do I need any special or additional rights within the shared dept email acct? I thought I did this in the past and was receiving errors regarding rights. Thanks again !!!
[DOUBLEPOST=1478722863][/DOUBLEPOST]I have a similar situation where I have PDFs stored in a folder. I'd like for Outlook to grab the individual PDF for a person, attach it to an email, place the person's email address in the to field, and store the message in the drafts folder of a group email box. This process would then be repeated for the next person until an email has been set up for all PDFs in the folder.

Does anyone know how to adjust the VBA code above to work as a macro in Outlook instead of Excel? or any other ideas on how I can accomplish this?