B
bony_tony
Hi, I've got the code below which extracts the subject and senders
name of emails in a specific folder, however, when I ask for
SenderEmailAddress, it is returning something like, /O=HAYS/OU=HAYS
ADMINISTRATIVE GROUP/CN=RECIPIENTS/CN=NXPEA which i'm guessing is the
internal reference for the person. How do I amend the code so that I
get their actual email address? ie (e-mail address removed)....?
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
ActiveSheet.Cells(i, 3).Value = olMail.SenderEmailAddress
i = i + 1
Next olMail
Set Fldr = Nothing
Set olNs = Nothing
Set olApp = Nothing
End Sub
name of emails in a specific folder, however, when I ask for
SenderEmailAddress, it is returning something like, /O=HAYS/OU=HAYS
ADMINISTRATIVE GROUP/CN=RECIPIENTS/CN=NXPEA which i'm guessing is the
internal reference for the person. How do I amend the code so that I
get their actual email address? ie (e-mail address removed)....?
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
ActiveSheet.Cells(i, 3).Value = olMail.SenderEmailAddress
i = i + 1
Next olMail
Set Fldr = Nothing
Set olNs = Nothing
Set olApp = Nothing
End Sub