Consulting

Results 1 to 3 of 3

Thread: Categorize Outgoing Mail - Macro

  1. #1
    VBAX Newbie
    Joined
    Aug 2017
    Posts
    2
    Location

    Question Categorize Outgoing Mail - Macro

    Hi,

    trying to have the categorize menu pop up when sending mail. I current have it working when it is new mail, but creates an error when I reply to a mail. I current have the code below in "ThisOutlookSession".

    Outlook 2016 - 32-bit

    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
    Anyone have a fix for this?

    Thanks.

  2. #2
    VBAX Mentor skatonni's Avatar
    Joined
    Jun 2006
    Posts
    347
    Location
    You pass Item with ByVal Item As Object. You are to use that item.

    Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
        If TypeOf Item Is Outlook.mailitem And Len(Item.Categories) = 0 Then
            Item.ShowCategoriesDialog
        End If
    End Sub
    To debug, mouse-click anywhere in the code. Press F8 repeatedly to step through the code. http://www.cpearson.com/excel/DebuggingVBA.aspx

    If your problem has been solved in your thread, mark the thread "Solved" by going to the "Thread Tools" dropdown at the top of the thread. You might also consider rating the thread by going to the "Rate Thread" dropdown.

  3. #3
    VBAX Newbie
    Joined
    Aug 2017
    Posts
    2
    Location

    Thumbs up

    Thanks, appears to be working now once I deleted the extra line.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •