Results 1 to 6 of 6

extracting Email from current date

Threaded View

  1. #1
    Registered User
    Join Date
    10-23-2019
    Location
    HONG KONG
    MS-Off Ver
    2010
    Posts
    8

    Unhappy extracting Email from current date

    Hi everyone,

    I am using one vba to extract the email, can I add some code inside to extracting only the email of the current date?
    Sub List_Email_Info()
    
    Dim i As Long
    ' Row tracker
    Dim arrHeader As Variant
    
    Dim olNS As NameSpace
    Dim olInboxFolder As MAPIFolder
    Dim olItems As Items
    Dim olMailItem As MailItem
    
    arrHeader = Array("Date Created", "Subject", "Sender's Name", "Unread")
    
    Set xlApp = CreateObject("Excel.Application")
    xlApp.Visible = True
    Set xlWB = xlApp.Workbooks.Add
    
    Set olNS = GetNamespace("MAPI")
    Set olInboxFolder = olNS.GetDefaultFolder(olFolderInbox).folders("current folder")
    Set olItems = olInboxFolder.Items
    
    
    
    i = 1
    
    On Error Resume Next
    
    xlWB.Worksheets(1).Range("A1").Resize(1, UBound(arrHeader) + 1).Value = arrHeader
    
    For Each olMailItem In olItems
        
        xlWB.Worksheets(1).Cells(i + 1, "A").Value = olItems(i).ReceivedTime
        xlWB.Worksheets(1).Cells(i + 1, "B").Value = olItems(i).Subject
        xlWB.Worksheets(1).Cells(i + 1, "C").Value = olItems(i).Body
        xlWB.Worksheets(1).Cells(i + 1, "D").Value = olItems(i).SentOnBehalfOfName
        
        i = i + 1
        
    Next olMailItem
    
    xlWB.Worksheets(1).Cells.EntireColumn.AutoFit
    
    MsgBox "Export complete.", vbInformation
    
    Set xlWB = Nothing
    Set xlApp = Nothing
    
    Set olItems = Nothing
    Set olInboxFolder = Nothing
    Set olNS = Nothing
    
    End Sub
    Thanks every expert!
    Last edited by a166769344; 11-05-2019 at 10:22 PM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. How to write macro to send email when date is matching with current date
    By gunanidhi in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-26-2016, 02:16 AM
  2. Extracting Email Received Date and Time and Subject line from Inbox (WebMail)
    By Naveed Raza in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-28-2015, 01:19 AM
  3. Replies: 0
    Last Post: 06-28-2014, 09:31 AM
  4. [SOLVED] Enter current date and time in subject of macro email
    By ExcelFailure in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-13-2013, 11:15 AM
  5. Modity on current code to prompt due date & auto email
    By cyee in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 07-05-2013, 04:00 AM
  6. Sending email using excel with current time/date
    By undergraduate in forum Excel General
    Replies: 1
    Last Post: 03-24-2010, 02:11 AM
  7. Extracting data from the current date
    By Cali00 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 04-14-2005, 01:06 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