Results 1 to 13 of 13

Thread: Categorizing emails based on the subject

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #10
    Is the With Events line at the top of the ThisOutlookSession module (before the macros, but after Option Explicit if present)?

    e.g.
    Option Explicit
    
    Private WithEvents Items As Outlook.Items
    
    Private Sub Application_Startup()
        Dim olApp As Outlook.Application
        'etc
    as for the attachments you will need to loop through the attachments collection e.g.
    For i = 1 To olItem.Attachments.Count
        If InStr(1, olItem.Attachments(i).fileName, "[CAT1]", vbTextCompare) > 0 Then
            olItem.Categories = "CAT1"
            olItem.Save
            Exit For
        End If
    Next i
    Last edited by Aussiebear; 01-18-2025 at 02:43 PM.
    Graham Mayor - MS MVP (Word) 2002-2019
    Visit my web site for more programming tips and ready made processes
    http://www.gmayor.com

Posting Permissions

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