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 - Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Add the macro in new mail form



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old December 24th 08, 12:20 PM posted to microsoft.public.outlook.program_forms
masani paresh[_2_]
external usenet poster
 
Posts: 84
Default Add the macro in new mail form

Hi,

I want to write macro on Send_Item() event. I have two below questions.
Could any one please help me out.

1. How to make new mail form default?
2. If certain condition not satiesfied then mail should not send and new
mail window should stay as it is. How could I canceled the sending mail?

Thanks,
Paresh
Ads
  #2  
Old December 24th 08, 03:22 PM posted to microsoft.public.outlook.program_forms
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default Add the macro in new mail form

See http://www.outlookcode.com/article.aspx?id=39 for how to make a form the
default for that type of item.

You want to handle the Item.Send event or the Application_ItemSend event?
The first is specific to that item and you'd need a handle to the item to be
able to subscribe to its Send event. The second is global to Outlook and
fires whenever any item is sent. Both have Cancel arguments that if set to
True will cancel the send.

So if your conditions don't test out in the event handler you can set Cancel
= True and leave the item unsent. Using the item.Send event will leave the
item open. Using Application_ItemSend will not since the item was already
sent out and now is being submitted to the mail transport.

You can search on www.outlookcode.com for examples of using both events. In
the case of item.Send you will need to subscribe to Inspectors.NewInspector
to be able to handle the opening of an item and then if it's a mail item you
can set up to handle the Inspector.CurrentItem which will be the mail item.
Then you need to subscribe to the Send event for that item.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"masani paresh" wrote in message
news
Hi,

I want to write macro on Send_Item() event. I have two below questions.
Could any one please help me out.

1. How to make new mail form default?
2. If certain condition not satiesfied then mail should not send and new
mail window should stay as it is. How could I canceled the sending mail?

Thanks,
Paresh


 




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
Opening a specific Custom form with a macro DawnTreader Outlook - Using Forms 6 July 22nd 09 02:32 PM
Run a macro when new message form opens mkboynton via OfficeKB.com Outlook and VBA 4 October 26th 07 08:04 PM
Need a macro to open a form Kathy Outlook - Using Forms 2 January 24th 07 05:24 PM
VBA Macro to Open Form LDMueller Outlook and VBA 2 December 19th 06 07:54 PM
Open Form from Macro [email protected] Outlook - Using Forms 5 June 17th 06 12:42 AM


All times are GMT +1. The time now is 08:44 PM.


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.