Outlook - Macro

nianchi111

Board Regular
Joined
Aug 24, 2007
Messages
197
Office Version
  1. 365
Dear Friends,

I have found a macro in google.

Its extracting all the data from Inbox to excel.

Concern: Unable to get the information of mails Replyed To and Replyed Time.

Please help me !!!!

Code:

Public Sub ReadOutlook()
Dim olApp As Outlook.Application
Dim olNamespace As Outlook.Namespace
Dim olItem As MailItem
Dim i As Integer
Dim b 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)
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?
Cells(i, 6) = olItem.ReplyRecipientNames ' RecipientNames
Cells(i, 7) = olItem.SentOn ' Replied Time
i = i + 1
Next
Range("F1").Select
ActiveCell.FormulaR1C1 = "=COUNTA(C[-5])"
Calculate
' subfolders and items within Inbox
Set olInbox = Nothing
Set olNamespace = Nothing
Set olApp = Nothing

End Sub
 
Last edited:

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)

Forum statistics

Threads
1,224,561
Messages
6,179,522
Members
452,923
Latest member
JackiG

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top