How to input "From"

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top