Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

1 Answer 1

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.ShowCategoriesDialog
        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 = ""
                m.Save
            End If
        End If
    Next
End Sub

Regards MF

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.