вівторок, 8 січня 2013 р.

sending mail from Excel

Example Code for sending mail from Excel
Ron de Bruin (last updated 6-March-2012)
Go back to the Excel tips page
The code is tested in Outlook Express, Windows Mail, Windows Live Mail and Outlook and It may or may not work with other email clients. All code on this page will work in Excel 97-2010 or Excel 2000-2010.
If you use Lotus Notes click here : http://www.rondebruin.nl/notes.htm
If you use Apple Mail or Outlook 2011 on a Mac click here : http://www.rondebruin.nl/mac.htm#Mail

There are four Microsoft mail programs:
Microsoft Outlook, Outlook Express, Windows Mail (replace Outlook Express in Vista) and Windows Live Mail. Microsoft Outlook is a part of Microsoft Office and Outlook Express and Windows Mail are a part of the operating system.
Note: Windows Mail is removed from Windows 7, as a alternitive you can install Windows Live Mail.
Windows Live Mail is a free program of Microsoft that you can download here :
http://download.live.com/wlmail

Important: if you set a Windows Live mail version before Windows Live mail 2011 as your default mail mail program it is possible that if you want to mail from Excel you get a General mail failure because it isn't fully  MAPI-qualified like Windows Mail or Outlook. Note: Microsoft fixed this problem in Windows Live mail 2011.
But the code in in the SendMail section is working correct in every version of Windows Live mail. 
But if you want to send directly with the mail address in the code the address must be in your contacts.

The code in the "SendMail method" section of this tips page are working with all four the mail programs.
The code in the "Outlook object model (attachment and body)" section of this tips page are only working with Microsoft Outlook. Because there is an object model for Outlook you have much more options when
you use the code in this two sections. A good alternative for the Outlook object model code on this page is the 
CDO for Win 2000 
code on my CDO page (no security warnings)


Add-ins and Worksheet Templates

If you want it easy without using VBA code then try one of the Add-ins on this page
Mail Add-ins for Excel (Free and very easy to use)

Or use a worksheet template from this page
Mail Worksheet Templates

*************************



Немає коментарів:

Дописати коментар