excelvbaemailoutlookcdo.message

VBA send Email with CDO from the current user adress


I try to send a email with a vba script that uses CDO and Outlook.

I use the script you can find here : http://www.cpearson.com/excel/Email.aspx

It works fine, but I want to send email from the Outlook account of the person using the vba. How I can get the email adress of the current user ?


Solution

  • It's impossible with CDO because .from is a required parameter.

    The solution is to use native Outlook VBA (course you should want to send your mail from Outlook not GMAIL or other). There is a lot of example here :

    http://www.rondebruin.nl/win/s1/outlook/amail1.htm

    http://www.rondebruin.nl/win/s1/outlook/mail.htm