Categorize new email

llravlin

Member
Outlook version
Outlook 2007
Email Account
Hi,

Is there a way to check an email after I open it to see if it has a category and if not open the category dialog box? I want this to happen automatically, not by a button. Can this be done using VBA?

Any help is appreciated,

Laura
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
You can use VBA to check for a category as a message is opened and open the category picker dialog if there is no category. I'm not sure it will work if you only use the reading pane.

This event runs when you open a message - it's a PITA IMHO, a close event would be better, but it's not working for me. There is also an open event - http://msdn.microsoft.com/en-us/library/office/ff865989(v=office.14).aspx - but its not doing anything here (same as close event :)).

Code:
Public WithEvents myOlInspectors As Outlook.Inspectors
Public myInspectorsCollection As New Collection

Private Sub Application_Startup()
    Initialize_handler
End Sub

Public Sub Initialize_handler()
    Set myOlInspectors = Application.Inspectors
End Sub

Private Sub myOlInspectors_NewInspector(ByVal Inspector As Outlook.Inspector)
If (Inspector.CurrentItem.Class = olMail) Then

    If Inspector.CurrentItem.Parent = "Inbox" Then
        strCats = Inspector.CurrentItem.Categories

        If strCats = "" Then
            Inspector.CurrentItem.ShowCategoriesDialog
        End If
    End If
End If
End Sub
 
Top