+ Reply to Thread
Results 1 to 2 of 2

look for text in email body and move email to a folder

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    08-02-2012
    Location
    Austria
    MS-Off Ver
    Excel 2007
    Posts
    457

    look for text in email body and move email to a folder

    Hi all,

    I'm looking for a solution that would read the body of the email and if it found a text like "completed" it should move it to folder that has the folder name "Completed"

    Any ideas how to get this going?

    Greetings.

  2. #2
    Forum Contributor
    Join Date
    08-02-2012
    Location
    Austria
    MS-Off Ver
    Excel 2007
    Posts
    457

    Re: look for text in email body and move email to a folder

    Hi all,

    I found a similar solution. This will move an email depending on the subject to a folder called "Old mail". For now it looks to a word that says "Test", but I would like it to find something that contains "Test" in the subject and later I can change this to find it in the body of the email. How Can I use the "LIKE" in the below code?

    Sub MoveItems()
     Dim myNameSpace As Outlook.NameSpace
     Dim myInbox As Outlook.Folder
     Dim myDestFolder As Outlook.Folder
     Dim myItems As Outlook.Items
     Dim myItem As Object
    
    
     Set myNameSpace = Application.GetNamespace("MAPI")
     Set myInbox = myNameSpace.GetDefaultFolder(olFolderInbox)
     Set myItems = myInbox.Items
     Set myDestFolder = myInbox.Folders("Old mail")
     Set myItem = myItems.Find("[Subject] = 'Test'")
     While TypeName(myItem) <> "Nothing"
     myItem.Move myDestFolder
     Set myItem = myItems.FindNext
     Wend
    End Sub
    Thank you in advance and greetings.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Move text from textbox to body of new email message
    By randomGuy15 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-12-2014, 10:10 AM
  2. vba pull data from outlook body of email through email or subject of mail into excel
    By breadwinner in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-01-2014, 04:37 AM
  3. Send New Email W/ Body of Received Email, Then Delete Sent Email
    By edneal2 in forum Outlook Formatting & Functions
    Replies: 2
    Last Post: 07-01-2013, 12:45 AM
  4. Replies: 0
    Last Post: 12-27-2012, 10:34 AM
  5. Replies: 4
    Last Post: 02-27-2012, 03:13 AM

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1