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

Tags: , ,

Sending Emails from Excel





 
 
Thread Tools Display Modes
  #1  
Old March 24th 07, 05:01 PM posted to microsoft.public.outlook.program_vba
Pete
external usenet poster
 
Posts: 4
Default Sending Emails from Excel

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  
Old March 25th 07, 03:47 PM posted to microsoft.public.outlook.program_vba
Sue Mosher [MVP-Outlook]
external usenet poster
 
Posts: 11,651
Default Sending Emails from Excel

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

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
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


All times are GMT +1. The time now is 04:59 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2008 Outlook Banter, part of the NewsgroupBanter project.
The comments are property of their posters.
Online Advertising - Horoscopes - Free Ringtones - Pet Insurance - Apply for Credit Card