Thread: Outlook Email
View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Nigel RS[_2_] Nigel RS[_2_] is offline
external usenet poster
 
Posts: 80
Default Outlook Email

Hi All
I am using Outlook to send emails from within Excel 2003. The security
message asking using to confirm they wish to send appears as expected. If
the uses presses 'Yes' everytnig works OK. How do I detect if the user
presses either the 'No' or 'Cancel' control as this causes an error.

Cheers
Nigel RS

Snippet of code follows.....
-----------------------------------------------------------
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(olMailItem)

With OutMail
.To = xmailAdd
.Subject = "CFAM File: " & xFName
.Attachments.Add xmailAttach, olByValue, 1, "Data File"
.DeleteAfterSubmit = False
On Error Resume Next
.Send
End With

Set OutMail = Nothing
Set OutApp = Nothing
--------------------------------------------------------