![]() |
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. |
|
|
Thread Tools | Search this Thread | Display Modes |
#2
|
|||
|
|||
![]()
You would need to set up event handling for every folder you are interested
in. The event handling would be for the folder's Items collection and would handle the ItemAdd() event. You would declare each folder as an Outlook.MAPIFolder object and then declare the folder's Items collection WithEvents so you can handle events for that Items collection. The best way would be to create a class module and have this code in it: Private WithEvents colItems as Outlook.Items Private oFolder As Outlook.MAPIFolder Private Sub colItems_ItemAdd(Item As Object) ' do whatever you want End Sub When you initialize an instance of this class module you would set the oFolder and colItems objects, the event will then fire when items are added to the folder. To keep the class and its objects alive you just add them to a Collection object. In the Application_Startup() event handler in ThisOutlookSession you would get each folder you want to handle and create an instance of your class, set the folder and items objects, then add the class to the Collection which would be declared at class level in ThisOutlookSession: Private colFolderItems As New Collection -- 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 "Nigel RS" wrote in message ... I currently have some VBA code that runs when an mail item arrives in my inBox, this is triggered by Inbox Rule. That works fine. I now need to be able to run some code when a user manually moves a mail item to a different folder within the MailBox. How can I detect this event? For example MailBox /InBox ... mail item 1 /Test When mail item 1 arrived a rule triggered some VBA code. If the user now drags mail item 1 from /InBox to folder /Test, I wish to run some code. This needs to differentiate 'from where' - 'to where' the item is moved. Please help! |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Move sent mail to sub sub folders | S1lverface | Outlook and VBA | 3 | April 23rd 08 12:52 AM |
objTargetFolder can't move item | [email protected] | Outlook - Using Forms | 2 | December 14th 06 11:14 PM |
How to move focus/selection to a particular contact/item in Explor | va | Outlook and VBA | 1 | September 28th 06 11:31 PM |
Let me move a Calendar item without sending an update | Winter | Outlook - Calandaring | 1 | May 29th 06 10:01 PM |
Item Move event | AtulSureka | Outlook and VBA | 1 | February 24th 06 01:33 PM |