Microsoft since 2005:
|Author: Michael Bauer||Homepage|
|Date: 01.02.2007||Accessed: 23092|
| || |
With a rule you could assign a category to any new item. But that isn't helpful if you don't know beforehand what to do with the item.
With VBA you're more flexible: For instance, you can assign a category to a new item after it has been moved to a specific folder.
In this example we watch a subfolder of the inbox, and the category name is defined on top in the 'AUTO_CATEGORY' constant.
Private WithEvents Items As Outlook.Items
Private Const AUTO_CATEGORY As String = "(test)"
Private Sub Application_Startup()
Dim Ns As Outlook.NameSpace
Dim Inbox As Outlook.MAPIFolder
Dim Subfolder As Outlook.MAPIFolder
Set Ns = Application.GetNamespace("MAPI")
Set Inbox = Ns.GetDefaultFolder(olFolderInbox)
Set Subfolder = Inbox.Folders("test")
Set Items = Subfolder.Items
Private Sub Items_ItemAdd(ByVal Item As Object)
Dim Cats() As String
Dim Exists As Boolean
If Len(Item.Categories) Then
Cats = Split(Item.Categories, ";")
For i = 0 To UBound(Cats)
If LCase$(Cats(i)) = LCase$(AUTO_CATEGORY) Then
Exists = True
If Exists = False Then
Item.Categories = Item.Categories & ";" & AUTO_CATEGORY
Item.Categories = AUTO_CATEGORY
ReplyAll alerts you before unintentionally replying all, or if you are a confidential BCC recipient of the ... [more]
Access the master category list in the blink of an eye, share your categories in a network, get a reminder service, and ... [more]
SAM automatically sets the sender, signature, and folder for sent items, for instance based on the recipient ... [more]
OLKeeper reliably prevents users from closing their Outlook window and thus possibly missing reminders or ... [more]