How do I code the From field in vba?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have the below code in my application which has been developed in Access.
I have Send on Behalf of permissions to multiple users mailboxes. I'm trying
to programmably add the From field poplulated with specific data from within
a database table similar to bcc: field. How do I code the "from" field?

If Len(Dir(entirePath)) > 0 Then
Set OutMail = OutApp.CreateItem(olMailItem)
With OutMail
.To = rs("EMail_Address").Value
'.SentOnBehalfOfName = "Great American SHS NonProfit"
Msg.From.EMail = rs("UW_Email_Address").Value
Msg.From.Name = rs("UW").Value

.Subject = rs("Person").Value & " Report for " & Format(Date,
"Long Date")
.BCC = rs("UW_Email_Address").Value
.Body = rs("Message").Value
.Attachments.Add (basePath & (rs("Code").Value) & ".pdf")
' .Attachments.Add rs("Actual_Path").Value
.Display
 
SentOnBehalfOfName is the correct property to set if you want to send from another Exchange mailbox.
 
Back
Top