Consulting

Results 1 to 2 of 2

Thread: Move emails that contain an ID number to a folder

  1. #1
    VBAX Newbie
    Joined
    Jun 2020
    Posts
    1
    Location

    Move emails that contain an ID number to a folder

    Hi there,

    Ive been looking for some time and trying new things however i cant figure it out.

    We have ID numbers that start with the letter K followed by 6 to 8 numbers e.g K123456 or K87654321

    80% of the time customers include this ID in the Subject line however some put it in the email itself.

    Is there a way to get these messages filtered into a folder called 'Case Updates'

    e.g when an email arrives if it contains K and a number from 100000 - 99999999 then mark as read and move to Case Updates

    Thank You in advance for any help

    Matt

  2. #2
    Use a rule that processes all incoming messages with the following script

    Sub MoveID(oItem As MailItem)
    Dim strSubject As String
    Dim olFolder As Folder
        olFolder = Session.GetDefaultFolder(olFolderInbox).folders("Case Updates")
        If TypeName(oItem) = "MailItem" Then
            strSubject = oItem.Subject
            If strSubject Like "*K###### *" Or strSubject Like "*K####### *" Or strSubject Like "*K######## *" Then
                oItem.Move olFolder
            End If
        End If
    lbl_Exit:
        Set olFolder = Nothing
        Exit Sub
    End Sub
    Last edited by gmayor; 06-19-2020 at 12:52 AM.
    Graham Mayor - MS MVP (Word) 2002-2019
    Visit my web site for more programming tips and ready made processes
    http://www.gmayor.com

Tags for this Thread

Posting Permissions

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