Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Junior Member
 
Posts: 6
Default 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   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 71
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Code to send a email via Macro in excel Sunil Somani[_2_] Excel Discussion (Misc queries) 1 September 30th 09 08:28 AM
Please help VBA code not working properly send email when due dates Tia[_3_] Excel Worksheet Functions 0 July 21st 09 08:37 AM
send email to each customer email in excel sheet. -keevill- Excel Discussion (Misc queries) 3 July 17th 08 02:33 PM
Code to send email to address within selection in Excel workbook vic1 Excel Discussion (Misc queries) 3 May 28th 08 09:51 PM
body of email disappears when I send an email from Excel ~A Excel Discussion (Misc queries) 0 February 25th 05 10:55 PM


All times are GMT +1. The time now is 02:08 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"