Hi,

Find the code below ... this would read the necessary things from Outlook 
inbox into Excel sheet. You will have to do some modifications to suit your 
own need. e.g. the code reads more than the subject of mail and sending 
date you may want to delete them and it creates a new sheet everytime it 
runs you may want to modify that section too

Copy paste the code in VBA editor. Go to Tools>References and find 
Microsoft Office Object Library and Microsoft Office Outlook Library tick 
mark to add them into references and run the code to test it.

Hope that helps,
Anand Kumar

Public Sub ReadOutlook()
     
    Dim olApp As Outlook.Application
    Dim olNamespace As Outlook.Namespace
    Dim olItem As MailItem
    Dim i As Integer
    Dim olInbox  As Outlook.MAPIFolder
    Dim olFolder As Outlook.MAPIFolder
    Dim lngCol As Long
     
    Set olApp = New Outlook.Application
    Set olNamespace = olApp.GetNamespace("MAPI")
     
     
     
    Set olInbox = olNamespace.GetDefaultFolder(olFolderInbox)
     
    Worksheets.Add
     
    i = 2
    For Each olItem In olInbox.Items
        Cells(i, 1) = olItem.SenderName ' Sender
        Cells(i, 2) = olItem.Subject ' Subject
        Cells(i, 3) = olItem.ReceivedTime ' Received
        Cells(i, 4) = olItem.ReceivedByName ' Recepient
        Cells(i, 5) = olItem.UnRead ' Unread?
        i = i + 1
    Next
     
    Range("F1").Select
    ActiveCell.FormulaR1C1 = "=COUNTA(C[-5])"
    Calculate
    Cells(1, 1) = "Sender"
    Cells(1, 2) = "Subject"
    Cells(1, 3) = "Received"
    Cells(1, 4) = "Recepient"
    Cells(1, 5) = "Unread?"
     
    For i = 1 To 5
        Columns(i).AutoFit
    Next i
     
     
    Set olInbox = Nothing
    Set olNamespace = Nothing
    Set olApp = Nothing
     
End Sub

On Monday, 26 March 2012 00:19:20 UTC+5:30, nike wrote:
>
> Dear Team,
>
> I want a macro for message names export to excel with  received dates.
>
>
> thanks in advance
> Simha
>
>

-- 
FORUM RULES (986+ members already BANNED for violation)

1) Use concise, accurate thread titles. Poor thread titles, like Please Help, 
Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get 
quick attention or may not be answered.

2) Don't post a question in the thread of another member.

3) Don't post questions regarding breaking or bypassing any security measure.

4) Acknowledge the responses you receive, good or bad.

5)  Cross-promotion of, or links to, forums competitive to this forum in 
signatures are prohibited. 

NOTE  : Don't ever post personal or confidential data in a workbook. Forum 
owners and members are not responsible for any loss.

------------------------------------------------------------------------------------------------------
To post to this group, send email to excel-macros@googlegroups.com

Reply via email to