Q: How to Intercept "Send" Button?

  • Thread starter Thread starter Kyle Ferrio
  • Start date Start date
K

Kyle Ferrio

Please indulge me in a naive question. I'm new to this and only vaguely
familiar with the Outlook object model.

I want my VBA code to execute /after/ the user clicks the "Send" button on
each individual email and /before/ the email is actually sent. Depending on
the content of the message, my VBA code will do something. So it's kind of
like the built-in spell-checker.

Where should I look to start traching myself how to do this?

Thanks,
Kyle
 
Use the Application.ItemSend event, e.g. :

Private Sub Application_ItemSend _
(ByVal Item As Object, Cancel As Boolean)
Dim strMsg As String
Dim res As Long
If Item.Subject = "" Then
Cancel = True
strMsg = "Please fill in the subject before sending."
MsgBox strMsg, _
vbExclamation + vbSystemModal, "Missing Subject"
Item.Display
End If
End Sub


And for VBA basics, see http://www.outlookcode.com/d/vbabasics.htm


--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
Ms. Mosher:

This is spot-on. I suppose this is all in your book, which I should
probably pick up in my next book-order.

Thanks!
Kyle
 
Back
Top