![]() |
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 |
#1
|
|||
|
|||
![]()
Hi everyone,
I need to set automatically a category to alll email in a IMAP folder. (and for every new incoming email in this folder) I've found this code in VBA but it give a category only to the selected email when the macro is launch. Sub essai() Dim MonApply As Outlook.Application Dim Expl As Explorer Dim myNameSpace As NameSpace Dim myFolder As MAPIFolder Dim myItems As Items Dim xi As Integer 'object instance Set MonApply = Outlook.Application 'Application Outlook 'Expl is current folder Set Expl = ActiveExplorer 'give you all datas embedded Set myNameSpace = MonApply.GetNamespace("MAPI") 'retreive ID folder to get all messages Set myFolder = myNameSpace.GetFolderFromID(Expl.CurrentFolder.Ent ryID) 'myItems is all items in this folder Set myItems = myFolder.Items For xi = 1 To myItems.Count 'this loop should give a category named as the folder name to all items in folder myItems.Item(xi).Categories = myFolder.Name Next xi End Sub |
Ads |
#2
|
|||
|
|||
![]() See the ItemAdd event. An example is available in the VBA help file. -- Best regards Michael Bauer - MVP Outlook Category Manager - Manage and share your categories: SAM - The Sending Account Manager: http://www.vboffice.net/product.html?lang=en Am Thu, 13 May 2010 10:26:32 +0200 schrieb notme: Hi everyone, I need to set automatically a category to alll email in a IMAP folder. (and for every new incoming email in this folder) I've found this code in VBA but it give a category only to the selected email when the macro is launch. Sub essai() Dim MonApply As Outlook.Application Dim Expl As Explorer Dim myNameSpace As NameSpace Dim myFolder As MAPIFolder Dim myItems As Items Dim xi As Integer 'object instance Set MonApply = Outlook.Application 'Application Outlook 'Expl is current folder Set Expl = ActiveExplorer 'give you all datas embedded Set myNameSpace = MonApply.GetNamespace("MAPI") 'retreive ID folder to get all messages Set myFolder = myNameSpace.GetFolderFromID(Expl.CurrentFolder.Ent ryID) 'myItems is all items in this folder Set myItems = myFolder.Items For xi = 1 To myItems.Count 'this loop should give a category named as the folder name to all items in folder myItems.Item(xi).Categories = myFolder.Name Next xi End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Move email messages to a specified folder based on a category | DougLost | Outlook and VBA | 2 | October 7th 10 04:18 PM |
VBA: set a category to all mail in a folder | notme | Outlook - General Queries | 1 | April 29th 10 04:38 PM |
Category Colours not showing in Public folder calendar | John McGregor | Outlook - Calandaring | 1 | December 8th 09 09:06 PM |
Sending emails by category, and folder with Outlook 2007 | Steve | Outlook - Using Contacts | 2 | February 1st 09 10:16 PM |
Copy centain contacts to new folder based on category | Bob Day | Outlook - Using Contacts | 0 | July 24th 06 10:41 PM |