View Single Post
  #1   Report Post  
Melisa Hutchins Melisa Hutchins is offline
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