A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Q: How to Intercept "Send" Button?



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old July 1st 06, 08:04 AM posted to microsoft.public.outlook.program_vba
Kyle Ferrio
external usenet poster
 
Posts: 1
Default Q: How to Intercept "Send" Button?

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



  #2  
Old July 1st 06, 04:01 PM posted to microsoft.public.outlook.program_vba
Sue Mosher [MVP-Outlook]
external usenet poster
 
Posts: 11,651
Default How to Intercept "Send" Button?

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
http://www.turtleflock.com/olconfig/index.htm
and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx

"Kyle Ferrio" wrote in message ...
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



  #3  
Old July 1st 06, 07:49 PM posted to microsoft.public.outlook.program_vba
Coatimundi
external usenet poster
 
Posts: 1
Default How to Intercept "Send" Button?


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


Sue Mosher [MVP-Outlook] wrote:
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


 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How can I implement a "Send Without Save" button Midwest Muskie Outlook - Installation 2 April 24th 06 10:53 PM
Allow "Contacts" button on the "Forward To" function in Outlook microwave Outlook - Using Contacts 1 April 20th 06 04:31 PM
how to add a custom button on the explorer "standard" commandbar Herve cadieu Outlook and VBA 1 March 17th 06 04:33 PM
adding a "print this slide" action button to powerpoint presentat ixratee Outlook - Using Forms 0 February 6th 06 11:14 PM
Outlook Default "Out of Office" button for scheduling in Calendar Blankblank Outlook - Calandaring 0 January 9th 06 08:06 PM


All times are GMT +1. The time now is 07:54 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.