View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
JNW JNW is offline
external usenet poster
 
Posts: 480
Default sending email without outlook messages

I've already checked out http://www.rondebruin.nl/mail/prevent.htm

I used the alt command to send the message. It worked great, but, all of a
sudden is not working anymore. I've downloaded the ClickYes program, but as
this application will be distributed widely I don't want to have to install
it on every computer.

The email is being created and displayed but not sent.

I've posted my code below. And I'm using xl2002 on xp Professional.

Thanks

Sub ResAlertForm_Email()
'This example send the last saved version of the Activeworkbook
'You must add a reference to the Microsoft outlook Library
Dim OutApp As Object
Dim OutMail As Object
Dim EmailAddr As String
Dim Subj As String

EmailAddr = Sheets("Reservation Alert Form").Range("T8")
Subj = Sheets("Reservation Alert Form").Range("B5") 'form title

Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)

With OutMail
.To = EmailAddr
.CC = ""
.BCC = ""
.Subject = "***TEST*** " & Subj
.Body = Subj
.Attachments.Add ActiveWorkbook.FullName
.Display 'or use .send and remove the next two lines
Application.Wait (Now + TimeValue("0:00:02"))
Application.SendKeys "%S"
End With
Set OutMail = Nothing
Set OutApp = Nothing

ActiveWorkbook.Save
ActiveWorkbook.Close
Application.DisplayAlerts = True
End Sub