Hi
There are third party programs that you can use but I don't have experience with it.
Use this to avoid the error if the user say No in the dialog
On Error Resume Next
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
On Error GoTo 0
--
Regards Ron de Bruin
http://www.rondebruin.nl
"JNW" wrote in message ...
Thanks for the reply. This is not absolutely necessary in the program (I
would think that most people understand that the email needs to be sent), but
would be nice.
Do you have any suggestions for something that would be reliable for wide
distribution?
"Ron de Bruin" wrote:
Hi JNW
Yes it is not reliable the SendKeys code.
You can try to wait longer then 2 seconds ?
Don't use the Send keys code if you want to distributed the code widely
The CDO code is great from my site but also not to distributed the code widely
--
Regards Ron de Bruin
http://www.rondebruin.nl
"JNW" wrote in message ...
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