I have modified some code to harvest email address from my outlook
It works perfectly for getting email names and address for incoming email addresses
However I now want to gather the email addresses of all the people I have sent messages to. The only mailitem property I can find is .to
This works for some but others just gives the persons name.
Any ideas how I can get the full email address from the mailitem property?
It works perfectly for getting email names and address for incoming email addresses
Code:
Sub GetFromInbox()
Application.ScreenUpdating = False
Dim olApp As Outlook.Application
Dim olNs As NameSpace
Dim Fldr As MAPIFolder
Dim olMail As MailItem
Dim i As Integer
Dim x As Integer
Dim y As Integer
Dim internalcount As Integer
Set olApp = New Outlook.Application
Set olNs = olApp.GetNamespace("MAPI")
Set Fldr = olNs.GetDefaultFolder(olFolderInbox)
Set Fldr = Fldr.Folders("2011").Folders("inbox")
UserForm1.Show False
i = 1
x = 1
Sheets("New").Cells.ClearContents
y = Fldr.Items.Count
For Each olMail In Fldr.Items
UserForm1.TextBox1.Value = x & " // " & y
UserForm1.Repaint
Sheets("New").Cells(i, 1).Value = olMail.SenderName
Sheets("New").Cells(i, 2).Value = olMail.SenderEmailAddress
i = i + 1
x = x + 1
On Error Resume Next
Next olMail
UserForm1.Hide
Set Fldr = Nothing
Set olNs = Nothing
Set olApp = Nothing
End Sub
However I now want to gather the email addresses of all the people I have sent messages to. The only mailitem property I can find is .to
This works for some but others just gives the persons name.
Any ideas how I can get the full email address from the mailitem property?