View Single Post
  #5  
Old April 22nd 08, 05:02 PM posted to microsoft.public.outlook.program_vba
Mike YO_BEE B
external usenet poster
 
Posts: 7
Default Can I capture the event ItemSend from a macro?

Here is my code. I am a newbie at coding, but I found this and it works, but
I am not sure how to have this code start up automaticlly upon the start up
of OUTLOOK

Public WithEvents myOlApp As Outlook.Application

Public Sub Initialize_handler()
Set myOlApp = CreateObject("Outlook.Application")
End Sub

Private Sub myOlApp_ItemSend(ByVal Item As Object, Cancel As Boolean)
Dim prompt As String
prompt = "Are you sure you want to send " & "?"
If MsgBox(prompt, 4 + 16, "This is a Warning!") = vbNo Then
Cancel = True
End If

End Sub


"Totem" wrote:

Hi,

I'm trying to capture the ItemSend event from a macro (not an add-in), but
for whatever reason it's not hitting it. Even after restarting Outlook
(2007), it does not kick in. Do I have to do something special?

Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
MsgBox("hi")
End Sub

or do I have to write an add-in?

Thanks

Ads