Results 1 to 2 of 2

Find outlook emails that match ID numbers in Excel

Threaded View

  1. #1
    Registered User
    Join Date
    05-11-2019
    Location
    Leicester, England
    MS-Off Ver
    Office 365
    Posts
    52

    Find outlook emails that match ID numbers in Excel

    Hi everyone,

    I have a list of ID numbers in excel and when we have sent an email it gets marked with the sent date and when we get the reply we mark it again. Due to user error some get missed so I've to get excel to search through outlook Sent box to see if an email had been sent.
    I now need to do this for the Inbox however there are many subfolders that the email could be hiding in and i only know how to search the main inbox, could anybody help me in getting it to also go through every subfolder?

    Also is there a way to make this quicker as it did take 3 days to complete!!! I came across maybe using "items.Restrict" not sure if that would work for what i need it for and if it would be quicker - https://docs.microsoft.com/en-us/off...items.restrict I did try however i couldn't understand/get it to work.

    The below code goes through outlook Sent box to find the emails that have been sent to change it to inbox i would change "olFolderSentMail" to "olFolderInbox" but that only looks in the inbox not sub folders.

    Sub CheckSentEmail()
      Dim OutlookMail As Variant
      Dim OutlookItems
      Dim subject As String
    
      Set OutlookItems = CreateObject("Outlook.Application").GetNamespace("MAPI").GetDefaultFolder(olFolderSentMail).Items
    
        For Each cell In Sheets("Tracker").Range("B2:B11891")
           
            For Each OutlookMail In OutlookItems
    
                If (InStr(1, OutlookMail.subject, cell, vbTextCompare) > 0) Then
                
                    If subject <> "" Then subject = subject & " | "
                    
                    subject = subject & OutlookMail & " - " & OutlookMail.ReceivedTime
                    cell.Offset(0, 16).Interior.ColorIndex = 4
                    
                End If
                
            Next
    
            cell.Offset(0, 44) = subject
            subject = ""
    
        Next
    
    MsgBox "Finished at " & Time
    
    End Sub
    Any help would be greatly appreciated especially if it makes the process quicker seeing as i was hoping to complete it by Monday

    Thank you for your help
    Martin
    Last edited by mtwa1990; 01-09-2021 at 04:49 AM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 5
    Last Post: 09-22-2020, 10:57 AM
  2. [SOLVED] Macro to Draft Outlook Emails and Attach files in Emails
    By arun.sj in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 08-17-2020, 05:48 AM
  3. [SOLVED] Excel VBA Outlook needing to add to and CC to outlook emails
    By flevojax in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-28-2018, 01:04 PM
  4. Track Outlook Emails - sent emails in Excel
    By baluraipur in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 12-06-2015, 09:18 AM
  5. [SOLVED] Sending Outlook emails from Excel; Limits to three emails only?
    By BPSJACK in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-29-2013, 06:53 AM
  6. Replies: 0
    Last Post: 02-09-2012, 12:30 PM
  7. Send outlook emails with message in cells to individual emails associated with them
    By abinayan in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-21-2011, 06:11 AM

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