Home |
Search |
Today's Posts |
#1
|
|||
|
|||
Send email from vba code in excel
Help!
I need to write code to send a work book when it is saved or when it is closed. This is what I have but it will not send the email. I am using excel 2003. I am very new to VBA. Sub Email() Dim OutApp As Object Dim OutMail As Object email_ = Range("F5") & ";" & Range("F3") cc_ = "" subject_ = "Flagged Order" body_ = "New Flagged Order" Set OutApp = CreateObject("Outlook.Application") Set OutMail = OutApp.CreateItem(0) With OutMail .To = email_ .Subject = subject_ .Body = body_ .CC = cc_ .Display End With Set OutMail = Nothing Set OutApp = Nothing End With End With End Sub Last edited by Melisa Hutchins : April 30th 10 at 04:05 PM |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
Send email from vba code in excel
I had the same question please look at the help I recieved it worked for me
see the threads: For Outlook "auto email worksheet and for Lotus Notes see: "Outlook vs Lotus Notes in macros" "Melisa Hutchins" wrote: Help! I need to write code to send a work book when it is saved or when it is closed. This is what I have but it will not send the email. I am using excel 2003. I am very new to VBA. Sub Email() Dim OutApp As Object Dim OutMail As Object email_ = Range("F5") & ";" & Range("F3") cc_ = "" subject_ = "Flagged Order" body_ = "New Flagged Order" Set OutApp = CreateObject("Outlook.Application") Set OutMail = OutApp.CreateItem(0) With OutMail .To = email_ .Subject = subject_ .Body = body_ .CC = cc_ .Display End With Set OutMail = Nothing Set OutApp = Nothing End With End With End Sub -- Melisa Hutchins . |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Code to send a email via Macro in excel | Excel Discussion (Misc queries) | |||
Please help VBA code not working properly send email when due dates | Excel Worksheet Functions | |||
send email to each customer email in excel sheet. | Excel Discussion (Misc queries) | |||
Code to send email to address within selection in Excel workbook | Excel Discussion (Misc queries) | |||
body of email disappears when I send an email from Excel | Excel Discussion (Misc queries) |