Outlook events

  • Thread starter Thread starter John
  • Start date Start date
J

John

Hi

I am using outlook with withevents to grab its item_send event. It has not
worked so far. Anyone has any example of how this should be done? My code is
at the end.

Thanks

Regards

= Code Follows ====================

Option Compare Database

Private WithEvents objOutlook As Outlook.Application
Private WithEvents objOutlookMsg As Outlook.MailItem

Private Sub Command0_Click()
Dim objOutlookRecip As Outlook.Recipient

Set objOutlook = CreateObject("Outlook.Application")
Set objOutlookMsg = objOutlook.CreateItem(olMailItem)
eto = "(e-mail address removed)"
esubject = ""
objOutlookMsg.To = eto
objOutlookMsg.Display
End Sub

Private Sub OutlookApp_ItemSend(ByVal Item As Object, ByRef Cancel As
Boolean)
MsgBox "I am here"
End Sub
 
You are using the wrong ItemSend event. Use objOutlook_ItemSend, not
OutlookApp_ItemSend - you don't have a declared variable named OutlookApp.
 
Back
Top