Extract email to excel from a specific sender

Status
Not open for further replies.

Kartyk

Member
Outlook version
Outlook 2010 64 bit
Email Account
Exchange Server
Hi,
Looking to extract email from outlook from a specific sender.

Can anyone please suggest modification to the code pls.

Dim olApp As Outlook.Application
Dim objNS As Outlook.Namespace
Set olApp = Outlook.Application
Set objNS = olApp.GetNamespace("MAPI")
Set myolItems = objNS.GetDefaultFolder(olFolderInbox).Items

For i = 1 To myolItems.Count
Set myitem = myolItems(i)
msgtext = myitem.Body

Range("c" & i + 6).Value = myitem.ReceivedTime
Range("d" & i + 6).Value = myitem.SenderName
Range("e" & i + 6).Value = myitem.Subject
Range("f" & i + 6).Value = myitem.Categories

Next
 

Kartyk

Member
Outlook version
Outlook 2010 64 bit
Email Account
Exchange Server
Thanks for your response. However, code picks all emails if condition doesnt seem to work ...
Not sure if am missing something here
 

Kartyk

Member
Outlook version
Outlook 2010 64 bit
Email Account
Exchange Server
Its working now. However, there is a concern. Although, emails dont get pulled up in the spreadsheet, empty rows can be seen, This is cuz I is defined prior to If condiition. Is there a way to only list emails from the ID and avoid all empty rows ?

Thanks
 
Status
Not open for further replies.
Top