B
bony_tony
Hi, I've got the macro below which lists the Subject and Senders name
of emails in a specific folder.
I also need to pull out which region the sender is in. If I double
click the senders name manually through outlook, the field I want to
extract is under Country/Region on the general tab.
Sub GetFromInbox()
Dim olApp As Outlook.Application
Dim olNs As NameSpace
Dim Fldr As MAPIFolder
Dim olMail As Variant
Dim i As Integer
Set olApp = New Outlook.Application
Set olNs = olApp.GetNamespace("MAPI")
Set Fldr = olNs.Folders("Public Folders").Folders("All Public
Folders").Folders("SYD").Folders("CredCheck-CP")
i = 1
For Each olMail In Fldr.Items
ActiveSheet.Cells(i, 1).Value = olMail.Subject
ActiveSheet.Cells(i, 2).Value = olMail.SenderName
i = i + 1
Next olMail
Set Fldr = Nothing
Set olNs = Nothing
Set olApp = Nothing
End Sub
Thanks
Tony
of emails in a specific folder.
I also need to pull out which region the sender is in. If I double
click the senders name manually through outlook, the field I want to
extract is under Country/Region on the general tab.
Sub GetFromInbox()
Dim olApp As Outlook.Application
Dim olNs As NameSpace
Dim Fldr As MAPIFolder
Dim olMail As Variant
Dim i As Integer
Set olApp = New Outlook.Application
Set olNs = olApp.GetNamespace("MAPI")
Set Fldr = olNs.Folders("Public Folders").Folders("All Public
Folders").Folders("SYD").Folders("CredCheck-CP")
i = 1
For Each olMail In Fldr.Items
ActiveSheet.Cells(i, 1).Value = olMail.Subject
ActiveSheet.Cells(i, 2).Value = olMail.SenderName
i = i + 1
Next olMail
Set Fldr = Nothing
Set olNs = Nothing
Set olApp = Nothing
End Sub
Thanks
Tony