|OLKeeper reliably prevents users from closing their Outlook window and thus possibly missing reminders or e-mails.|
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 sample 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 ' Automatically assign this category 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") ' Inbox Set Inbox = Ns.GetDefaultFolder(olFolderInbox) ' Subfolder of the inbox Set Subfolder = Inbox.Folders("test") Set Items = Subfolder.Items End Sub Private Sub Items_ItemAdd(ByVal Item As Object) Dim Cats() As String Dim i& Dim Exists As Boolean If Len(Item.Categories) Then ' Check whether the category is assigned yet Cats = Split(Item.Categories, ";") For i = 0 To UBound(Cats) If LCase$(Cats(i)) = LCase$(AUTO_CATEGORY) Then Exists = True Exit For End If Next If Exists = False Then Item.Categories = Item.Categories & ";" & AUTO_CATEGORY Item.Save End If Else Item.Categories = AUTO_CATEGORY Item.Save End If End Sub
|Determine the "identity" of your emails. Set with SAM the sender and the folder folder for sent items with the help of rules.|