• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

help on VBA Code

any Idea how to get Date in separate column.

code shows only -> Cells(n, 4) = olMail.ReceivedTime

I have shared my full code below.. Please help!
 
FULL CODE:

>>> use code - tags <<<
Code:
Dim n As Long
Sub Launch_Pad()
  Dim olApp As Outlook.Application
  Dim olNS As Outlook.Namespace
  Dim olFolder As Outlook.MAPIFolder
  Dim Date1
  Date1 = Date
  Set olApp = Outlook.Application
  Set olNS = olApp.GetNamespace("MAPI")
  Set olFolder = olNS.PickFolder
Call ProcessFolder(olFolder, Date1)
  Set olNS = Nothing
  Set olFolder = Nothing
  Set olApp = Nothing
  Set olNS = Nothing
End Sub
Sub ProcessFolder(olfdStart As Outlook.MAPIFolder, Date1)
  Dim olFolder As Outlook.MAPIFolder
  Dim olObject As Object
  Dim olMail As Outlook.MailItem
  n = Cells(Rows.Count, 1).End(xlUp).Row
  For Each olObject In olfdStart.Items
    If TypeName(olObject) = "MailItem" Then
  
      If olObject.ReceivedTime >= Date1 Then
        n = n + 1
        Set olMail = olObject
        Cells(n, 1) = n
        Cells(n, 2) = olMail.SenderEmailAddress
        Cells(n, 3) = olMail.Subject
        Cells(n, 4) = olMail.ReceivedTime
        Cells(n, 5) = olMail.SenderName
    
        Cells(n, 6) = Int(olMail.Size / 1024) & " " & "KB"
    
      End If
    End If
 
Last edited by a moderator:
Back
Top