How to input "From"

  • Thread starter Thread starter Box666
  • Start date Start date
B

Box666

I have an automated program that sends emails from within Accrss. Part
of the code is below, but as well as the "To" and "Cc" I would also
like to use the "From" box, Could somebody please advise me how to
code this.

With thanks

Bob

Sub sbSendLetter(Optional AttachmentPath)
Dim objOutlook As Outlook.Application
Dim objOutlookMsg As Outlook.MailItem
Dim objOutlookRecip As Outlook.Recipient
Dim objOutlookAttach As Outlook.Attachment

On Error GoTo ErrorMsgs

' Create the Outlook session.
Set objOutlook = CreateObject("Outlook.Application")
' Create the message.
Set objOutlookMsg = objOutlook.CreateItem(olMailItem)
With objOutlookMsg
' Add the To recipient(s) to the message. Substitute your names
here
' your names here.
Set objOutlookRecip = .Recipients.Add([Forms]![Send_Letters]!
[Recipiant])
objOutlookRecip.Type = olTo
' Add the CC recipient(s) to the message.
Set objOutlookRecip = .Recipients.Add([Forms]![Send_Letters]!
[Copy reply to])

objOutlookRecip.Type = olCC
' Set the Subject, Body, and Importance of the message.
 
Back
Top