Outlook 2013 Categorise emails on sending - macro not working in Preview mode

panesai1

Member
Outlook version
Outlook 2013 32 bit
Email Account
Office 365 Exchange
Hello,

I use the following macro to assign a category to any outgoing email message (Outlook 2013)

'Categorize Sent Items
'Place in ThisOutlookSession
Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
If TypeOf Item Is Outlook.MailItem And Len(Item.Categories) = 0 Then
Set Item = Application.ActiveInspector.CurrentItem
Item.ShowCategoriesDialog
End If
End Sub
The macro works fine when the email message is "Popped out" into its own window.

However, when i work within the Outlook Reading pane (e.g. clicking Reply or Reply-to-all from within the Outlook reading pane) and then try to send without popping the composed message into its own window pane, the macro does not work.
I get the macro debugger alert highlighting the following error prompt:

Runtime error 91
Object variable or With block variable not set.

'Categorize Sent Items
'Place in ThisOutlookSession
Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
If TypeOf Item Is Outlook.MailItem And Len(Item.Categories) = 0 Then
Set Item = Application.ActiveInspector.CurrentItem
Item.ShowCategoriesDialog
End If
End Sub

Is this a Outlook 2013 bug?

Any help would be appreciated.

many thanks
 
Top