Take the 2-minute tour ×

I can easily set the category of an email I receive using the categorize drop down. However, I want to be able to set the category of an email I send. I could send it, then go in to Sent Items afterward, but I'd really prefer to have the categorize drop down on the ribbon of the new mail message so I can set the category before I hit send. However, I can't find that anywhere in the customize ribbon stuff.

I can open up tags, and do it in there, but I'd rather have the quick access that I have in other ribbons (such as categorizing an email I receive.)

Can someone point me in the right direction?

share|improve this question
add comment

1 Answer

You need this; if no category is set, the send operation is cancelled:

Private Sub Application_ItemSend(ByVal item As Object, Cancel As Boolean)
    Dim oc As OlObjectClass
    oc = item.Class
    If oc = olMail Or oc = olReport Or oc = olMeetingRequest Then
        item.BillingInformation = item.Categories
        If item.Categories = "" Then Cancel = True
    End If
End Sub

BillingInformation is set too, since it's transmitted back unaltered when your recipients reply, so incoming answers are already categorized properly.... for that to work you'll need this as well:

Private Sub Application_NewMailEx(ByVal EntryIDCollection As String)
    Dim arr() As String, i As Integer
    Dim ns As Outlook.NameSpace
    Dim itm, m As MailItem

    On Error Resume Next
    Set ns = Application.Session
    arr = Split(EntryIDCollection, ",")
    For i = 0 To UBound(arr)
        Set itm = ns.GetItemFromID(arr(i))
        If itm.Class = olMail Then
            Set m = itm
            If m.Categories = "" And m.BillingInformation  "" Then
                m.Categories = m.BillingInformation
                m.BillingInformation = ""
            End If
        End If
End Sub

Regards MF

share|improve this answer
add comment

Your Answer


