Categorise emails on sending - macro not working in Preview mode

Status
Not open for further replies.

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
 
Status
Not open for further replies.
Similar threads
Thread starter Title Forum Replies Date
C Multiple emails Using Outlook 1
Phillip Bit.ly emails Using Outlook 1
E Work uses live accounts for emails for all employees. Can we use the outlook calendar to give the employees an universal work schedule calendar? Using Outlook 1
G Alerting on missed emails in conversation Outlook VBA and Custom Forms 1
C Macro to extract sender name & subject line of incoming emails to single txt file Outlook VBA and Custom Forms 3
M Sync 'On my computer' emails Using Outlook 1
A Apply Selected Emails to outlook rules and Run Rules Using Outlook 5
A Run-time error '430' on certain emails when trying to set "Outlook.mailitem" as "ActiveExplorer.Selection.Item" Outlook VBA and Custom Forms 2
J Moved many emails to Outlook external folder, need to delete on Gmail server Using Outlook 14
P Move emails between 2 mailboxes. Using Outlook 0
R Assign Categories "Round Robin" style but in a shared mailbox but on specific emails only Outlook VBA and Custom Forms 8
P Outlook for Mac - emails are not sent out beginning last week Using Outlook 1
M Missing emails in Inbox, but are present in webmail Using Outlook 0
A How To Get Body of All Emails to view in Blue Using Outlook 1
A How to get body of all emails in outlook 2016 to view in blue color Using Outlook 1
N Extract Outlook emails to excel Outlook VBA and Custom Forms 2
M Group of emails Using Outlook 1
I Saving attachments from multiple emails and updating file name Outlook VBA and Custom Forms 0
R List folders in a combo box + select folder + move emails from inbox to that folder + reply to that email Outlook VBA and Custom Forms 1
D Assign categories to outgoing emails Outlook VBA and Custom Forms 0
J Outlook 2016 Moving IMAP emails to Exchange Using Outlook 1
P Flagging emails in conversations Using Outlook 2
V Outlook 2016 will not move emails in search results Using Outlook 4
D Outlook 2016 Deleting emails without affecting folder structure - Outlook Office 365 Using Outlook 3
M Filter Conversations - Filter Out Single Emails Outlook VBA and Custom Forms 3
F not receiving emails until i re-login Using Outlook 2
K No emails in inbox Using Outlook.com accounts in Outlook 1
A Record opened emails for reopening later Outlook VBA and Custom Forms 16
N VBA to delete duplicates by message-id on common pst for 2 or more emails Outlook VBA and Custom Forms 0
R Deleting emails from storage folder Outlook VBA and Custom Forms 1
R Outlook for Mac - Advanced Search and Tracking Sent Emails Using Outlook 0
DoctorJellybean Outlook 365 doesn't always mark emails as read Using Outlook 3
N Sent emails not reflected in all IMAP Folders Using Outlook 4
A Custom VBA to sort emails into folders Outlook VBA and Custom Forms 0
L Moving emails with similar subject and find the timings between the emails using outlook VBA macro Outlook VBA and Custom Forms 1
S How can I delete all copies of a given companies logo graphic from all my emails at once? Using Outlook 3
Y Open and Save Hyperlink Files in multiple emails Outlook VBA and Custom Forms 9
L Time format in Outlook calendar and emails Using Outlook 0
G Parsing All Emails Outlook VBA and Custom Forms 8
J Set Timer/Countdown on Emails? Outlook VBA and Custom Forms 3
T Render Outlook emails in MS access as they appear in Outlook Outlook VBA and Custom Forms 2
O Delete duplicate emails - subscription notifications Using Outlook 5
N Outlook rules don't create a copy for bcc'ed emails Using Outlook 3
R Can not create folder to store specific emails in in Outlook for Mac Using Outlook 1
V Emails remain in Drafts folder even though they have been sent Using Outlook 4
B Vba to monitor time to respond to emails using a shared mailbox Outlook VBA and Custom Forms 5
T Deleting duplicate emails Using Outlook 2
N Copies of emails from rules have wrong from: account Using Outlook 0
V Emails going into Drafts instead of Sent folder Using Outlook 3
H tracking time of emails Outlook VBA and Custom Forms 2

Similar threads

Top