A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

How to input "From"



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old August 4th 07, 01:10 AM posted to microsoft.public.outlook.program_vba
Box666
external usenet poster
 
Posts: 3
Default How to input "From"

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.

Ads
  #2  
Old August 4th 07, 09:00 PM posted to microsoft.public.outlook.program_vba
Dmitry Streblechenko
external usenet poster
 
Posts: 2,116
Default How to input "From"

Set the SentOnBehalfOfName property (Exchange specific); you must have an
explicit permission to send on behalf of the specified user.
In case of sending through an SMTP server, see
http://www.dimastr.com/redemption/faq.htm#14

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool

"Box666" wrote in message
ups.com...
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.



 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
"Outlook 2007" +"The Messenger interface has returned an unknown error" deleteriousone Outlook - General Queries 0 February 7th 07 12:48 AM
Outlook 2007 / 2003: Error 0x800CCC81 - E-Mail address with "." before "@" Stephan Kuehn Outlook - General Queries 10 January 25th 07 06:09 PM
Include "Telecommuting" or "Teleworking" as a "Show time as" statu Gordon Greene Outlook - Calandaring 0 July 31st 06 03:37 PM
Cannot "Open" "Import/Export' or use "Data File Management" Ed Isenberg Outlook - Installation 3 July 16th 06 12:31 AM
Outlook express address book, "tools", "option" feature missing f. Brad Outlook - Using Contacts 3 March 11th 06 11:46 PM


All times are GMT +1. The time now is 05:08 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.