![]() |
| 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. |
|
|||||||
| Tags: emails, excel, sending |
|
|
Thread Tools | Display Modes |
|
#1
|
|||
|
|||
|
I have code which creates an Email from within Excel. This creates an Email
from the default Email account in Outlook. Is it possible to create an Email from any other account set-up in Outlook other than from the default account? Dim OutApp As Object Dim OutMail As Object Set OutApp = CreateObject("Outlook.Application") OutApp.Session.Logon Set OutMail = OutApp.CreateItem(0) On Error Resume Next With OutMail .To = ToAddressTxt .Subject = SubjectTxt .Body = BodyTxt .Display End With |
| Ads |
|
#2
|
|||
|
|||
|
Outlook 2007 adds a MailItem.SendUsingAccount property.
For earlier versions, Outlook provides no direct way to change the account for an outgoing message. These are known workarounds using native Outlook functionality: 1) If the user has Outlook 2002/3 and is not using WordMail as the editor, you set the sending account using CommandBars techniques. See http://www.outlookcode.com/codedetail.aspx?id=889 for sample code. 2) In an Exchange environment where you want to use another user's mailbox as the From address, set the MailItem.SentOnBehalfOfName property. If you do not want the current user's name to appear in the message at all, the Exchange administrator must grant Send As permission on the other user's mailbox. 3) If you're mainly concerned about replies to your message going to the correct place, add the desired reply address to the MailItem.ReplyRecipients collection. The third-party Redemption ( http://www.dimastr.com/redemption/ ) library adds two other solutions: 4) Set an RFC822 header property, as described at http://www.dimastr.com/redemption/faq.htm#14 5) Set the RDOMail.Account property, as described at http://www.dimastr.com/redemption/rdo/RDOMail.htm -- Sue Mosher, Outlook MVP Author of Configuring Microsoft Outlook 2003 http://www.turtleflock.com/olconfig/index.htm and Microsoft Outlook Programming - Jumpstart for Administrators, Power Users, and Developers http://www.outlookcode.com/jumpstart.aspx "Pete" wrote in message ... I have code which creates an Email from within Excel. This creates an Email from the default Email account in Outlook. Is it possible to create an Email from any other account set-up in Outlook other than from the default account? Dim OutApp As Object Dim OutMail As Object Set OutApp = CreateObject("Outlook.Application") OutApp.Session.Logon Set OutMail = OutApp.CreateItem(0) On Error Resume Next With OutMail .To = ToAddressTxt .Subject = SubjectTxt .Body = BodyTxt .Display End With |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Sending emails in Excel by Outlook | tony wong | Outlook and VBA | 1 | December 23rd 06 04:17 PM |
| Sending Mail from Excel with VBA | RFraley | Outlook and VBA | 4 | November 9th 06 05:33 PM |
| Sending email from source Excel spreadsheet | Richard Edwards | Outlook - General Queries | 1 | August 9th 06 08:15 PM |
| Problem sending mail via excel | Jas | Outlook and VBA | 2 | April 8th 06 09:44 PM |
| Exporting Contacts from Outlook emails don't go thru into Excel | neilccarter | Outlook - Using Contacts | 1 | January 18th 06 06:58 AM |