awbrown
05-01-2017, 12:47 PM
I'm attempting to send an email using MailEnvelope via MS Word and MS Outlook 2010, but I want to send it via a specific email account other than the default. I can send the email via default with no errors with "itm.send", but if I attempt to send it via "itm.SendUsingAccount" it errors with "Method 'SendUsingAccount' of object'_MailItem' failed". I also attempted to change from "itm As Object" to "itm As Outlook.MailItem", but this results in "item = nothing". Anyone know how to make this work?
Dim itm As Object
Dim ID As String
Set itm = objNurse_Employment_Intro_Email.MailEnvelope.Item
With itm
.To = (employ_fname & " " & employ_m_initial & " " & employ_lname)
.Subject = "Agreement"
.Attachments.Add Path_To_ftc_Fldr & Nurse_Agreement_File_To_Complete
.Save
ID = .EntryID
End With
' Set itm = Nothing
Set itm = applOutlook.Session.GetItemFromID(ID)
itm.SendUsingAccount = applOutlook.Session.Accounts.Item(3)
Dim itm As Object
Dim ID As String
Set itm = objNurse_Employment_Intro_Email.MailEnvelope.Item
With itm
.To = (employ_fname & " " & employ_m_initial & " " & employ_lname)
.Subject = "Agreement"
.Attachments.Add Path_To_ftc_Fldr & Nurse_Agreement_File_To_Complete
.Save
ID = .EntryID
End With
' Set itm = Nothing
Set itm = applOutlook.Session.GetItemFromID(ID)
itm.SendUsingAccount = applOutlook.Session.Accounts.Item(3)