+ Reply to Thread
Results 1 to 12 of 12

List of email addresses from inbox

Hybrid View

  1. #1
    Spammer
    Join Date
    10-23-2012
    Location
    Adelaide, Australia
    MS-Off Ver
    Excel 2003, Office 365
    Posts
    1,237

    Re: List of email addresses from inbox

    I cannot test properly as I don't get emails from an Internal Exchange, but try this modification;
    Option Explicit
    Public Sub ReadOutlookEmails()
        'Microsoft Outlook XX.X Object Library is required to run this code
    
        Dim objFolder As Outlook.Folder
        Dim objNS As Outlook.Namespace
        Dim objMail As Outlook.MailItem
        Dim lCounter As Long
        Dim Count As Long
        Sheet1.Range("C:D") = ""
        Set objNS = Outlook.GetNamespace("MAPI")
        Set objFolder = objNS.GetDefaultFolder(olFolderInbox)
    
        On Error Resume Next
        For lCounter = 1 To objFolder.Items.Count
            Application.DisplayStatusBar = True
            Application.StatusBar = "Reading mail item number " & lCounter
            Set objMail = objFolder.Items.Item(lCounter)
            If objMail.ReceivedTime > Sheet1.Range("B1").Value + 1 Then
                Exit For
            End If
            If objMail.ReceivedTime >= Range("A1").Value Then
                Count = Count + 1
                If objMail.SenderEmailType = "SMTP" Then
                    Sheet1.Range("C" & Count).Value = objMail.SenderEmailAddress
                Else
                    Sheet1.Range("C" & Count).Value = objMail.Sender.GetExchangeUser.PrimarySmtpAddress
                End If
                Sheet1.Range("D" & Count).Value = objMail.ReceivedTime
            End If
        Next
        On Error GoTo 0
        MsgBox "Done", vbInformation
         Application.DisplayStatusBar = False
    End Sub
    Last edited by Croweater; 02-06-2023 at 05:43 AM.

  2. #2
    Forum Contributor
    Join Date
    08-02-2012
    Location
    Pune
    MS-Off Ver
    Office 365 (Win 10)
    Posts
    489

    Re: List of email addresses from inbox

    Still not.
    its ok, I will try to explore with the code you gave. Thanks
    Please make the Post as solved, when you get your answer & Click * if you like my suggestion

+ 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. Need to know who was removed or added from a list of email addresses
    By dorlow in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 02-15-2020, 02:05 AM
  2. Replies: 0
    Last Post: 02-11-2019, 08:45 AM
  3. Replies: 3
    Last Post: 11-29-2014, 07:30 AM
  4. Extract Inbox/Sent Items emails addresses from following fields: FROM, TO, CC, BCC
    By ana.ciofrangeanu in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-05-2014, 08:00 AM
  5. Removing email addresses from list
    By excelquestion1 in forum Excel General
    Replies: 12
    Last Post: 08-16-2013, 05:47 AM
  6. Look up a list of email addresses?
    By akopp in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 09-25-2008, 05:54 PM
  7. [SOLVED] Excel List of Email Addresses
    By Jenny in forum Excel General
    Replies: 3
    Last Post: 05-23-2006, 05:25 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