none
Outlook object - cancel RRS feed

  • Question

  • So I have this program in VBA that builds an e-mail and Displays the Outlook object that holds the e-mail awaiting user responce. Is there a way to check if the user clicked cancel or send?
    Wednesday, May 25, 2016 9:34 PM

All replies

  • >>>So I have this program in VBA that builds an e-mail and Displays the Outlook object that holds the e-mailawaiting user responce. Is there a way to check if the user clicked cancel or send?

    According to your description, you could use MailItem.Send Event (Outlook) and MailItem.Close Event (Outlook) to check if the user clicked cancel or send:

    Public WithEvents myItem As Outlook.MailItem 
     
    Sub SendMyMail() 
     
     Set myItem = Outlook.CreateItem(olMailItem) 
     
     myItem.To = "Dan Wilson" 
     
     myItem.Subject = "Data files information" 
     
     myItem.Send 
     
    End Sub 
     
    Private Sub myItem_Send(Cancel As Boolean) 
     
     myItem.ExpiryTime = #2/2/2003 4:00:00 PM# 
     
    End Sub

    For more information, click here to refer about MailItem.Send Event (Outlook) and here to refer about MailItem.Close Event (Outlook)

    Thursday, May 26, 2016 2:21 AM