Results 1 to 3 of 3

EXCEL VBA - Problem to search an email in Outlook folder

Threaded View

gkumthekar EXCEL VBA - Problem to search... 10-18-2013, 06:56 PM
gkumthekar Re: [ Solved] EXCEL VBA -... 10-19-2013, 12:02 AM
arlu1201 Re: EXCEL VBA - Problem to... 10-21-2013, 05:08 AM
  1. #1
    Registered User
    Join Date
    08-08-2013
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    8

    EXCEL VBA - Problem to search an email in Outlook folder

    Hi All,

    I have a code for EXCEL VBA that searches for email messages in certain folder of Outlook ( both 2007 version). However, the comparison starts from the lastest email in the folder and not from the first email. ( in Outlook, I prefer to keep the email messages sorted as Newest first and would like to get the first email that matches the subject line provided.

    Can you please help me reverse the order in which the EXCEL VBA is searching for the email? Below is the code:


    Sub Otsearch()
    
    Dim myOlApp As Outlook.Application
    
    Set myOlApp = CreateObject("Outlook.Application")
    Set myNameSpace = myOlApp.GetNamespace("MAPI")
    Set myfolders = myNameSpace.Folders
    
    n = 1
    Do Until myfolders.Item(n) = "Personal Folders"
    n = n + 1
    Loop
    
    Set myfolder = myfolders.Item(n)
    Set myfolder2 = myfolder.Folders("Me")
    Range("C23") = 0
    c = 1
    n = 1
    num = myfolder2.items.Count
    
    
    For Each Item In myfolder2.items
    itsj = Item.Subject
    If itsj <> "Open Cases - Oct_10_2_AM.xls" Then GoTo 10
    itsn = Item.SenderName
    Range("B23") = "Match FOund"
    Range("C23") = Range("C23") + 1
    10
    n = n + 1
    Range("A23") = n - 1
    Cells(23 + n - 1, 1) = itsj
    
    Next Item
    
    End Sub


    Thanks in advance for help.


    Regards,
    Ganesh K
    Last edited by arlu1201; 10-21-2013 at 05:08 AM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 0
    Last Post: 06-26-2013, 01:18 PM
  2. Problem amending email subject in Outlook using Excel VBA
    By madbloke in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-24-2012, 12:09 PM
  3. Problem with Excel accessing an Outlook email body
    By krussell in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-15-2009, 04:15 PM
  4. search outlook contacts in excel and return email address to variable
    By wotadude in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-27-2008, 06:08 PM
  5. Excel Email with Outlook - Mailbox full problem
    By ging18 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-01-2006, 12:42 PM

Tags for this Thread

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