| | Awarded by Microsoft: |  |
| | VBOffice Info | | Visitors | 726296 | | Impressions | 2784369 |
| |
|
| |
| Author: Michael Bauer | Homepage | | Date: 17.10.2008 | Accessed: 8384 | | | | Description
Frequently, you assign a category to an e-mail, and then move it into another folder. With this example you may automate that: When you assign a specific category to an e-mail, the e-mail will be moved into a subfolder of your Inbox.
You just need to customize two variables (in the procedure 'Mail_PropertyChange', labeled with 'Customize): Determine the category name you want to handle and the name of the subfolder. |
Private WithEvents Explorer As Outlook.Explorer
Private WithEvents Mail As Outlook.MailItem
Private Sub Application_Startup()
Dim Ns As Outlook.NameSpace
Set Ns = Application.GetNamespace("MAPI")
Set Explorer = Application.ActiveExplorer
End Sub
Private Sub Explorer_SelectionChange()
Dim obj As Object
Dim Sel As Outlook.Selection
Set Mail = Nothing
Set Sel = Explorer.Selection
If Sel.Count > 0 Then
Set obj = Sel(1)
If TypeOf obj Is Outlook.MailItem Then
Set Mail = obj
End If
End If
End Sub
Private Sub Mail_PropertyChange(ByVal Name As String)
Dim Ns As Outlook.NameSpace
Dim SubfolderName As String
Dim Inbox As Outlook.MAPIFolder
Dim Subfolder As Outlook.MAPIFolder
Dim i&
Dim Cats As String
Dim arrCats() As String
Dim FindCategory As String
FindCategory = " (Actionlist)"
SubfolderName = "test"
Set Ns = Application.GetNamespace("MAPI")
Set Inbox = Ns.GetDefaultFolder(olFolderInbox)
Set Subfolder = Inbox.Folders(SubfolderName)
If Subfolder.EntryID = Mail.Parent.EntryID Then
Exit Sub
End If
FindCategory = LCase$(FindCategory)
If Name = "Categories" Then
Cats = Mail.Categories
If Len(Cats) = 0 Then Exit Sub
Cats = Replace(Cats, ",", ";")
arrCats = Split(Cats, ";")
For i = 0 To UBound(arrCats)
Cats = LCase$(arrCats(i))
If Cats = FindCategory Then
Mail.Move Subfolder
Set Mail = Nothing
Exit For
End If
Next
End If
End Sub
|
| | |
| | |  | 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] |
| |
|