Add the macro in new mail form

M

masani paresh

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
 
K

Ken Slovak - [MVP - Outlook]

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.
 

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