Outlook events

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
 
E

Eric Legault [MVP - Outlook]

You are using the wrong ItemSend event. Use objOutlook_ItemSend, not
OutlookApp_ItemSend - you don't have a declared variable named OutlookApp.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top