Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 277
  • Last Modified:

Resolve email id's and unresolved email id's get them into an excel.

Hi,

Resolve email id's and unresolved email id's get them into an excel.
Below is a working code that gets the unresolved names to a txt file
can i get the data into an excel as

ColumA    ColumB
Name  Resolved/Unresolved

So i can filer and copy as required later

Regards
Sharath
Sub GetUnresolved()
    Dim objFSO As Object, objFile As Object, olkRecipient As Outlook.Recipient
    Set objFSO = CreateObject("Scripting.FileSystemObject")
    'Change the file name and path on the next line'
    Set objFile = objFSO.CreateTextFile("D:\Unresolved Addresses.txt", True)
    For Each olkRecipient In Outlook.ActiveInspector.CurrentItem.Recipients
        If Not olkRecipient.Resolved Then
            objFile.WriteLine olkRecipient.Name
        End If
    Next
    objFile.Close
    Set objFile = Nothing
    Set objFSO = Nothing
    Set olkRecipient = Nothing
    MsgBox "Done"
End Sub

Open in new window

0
bsharath
Asked:
bsharath
  • 2
  • 2
1 Solution
 
David LeeCommented:
Sharath,

This should do it.
Sub GetUnresolved()
    Dim objFSO As Object, objFile As Object, olkRecipient As Outlook.Recipient
    Set objFSO = CreateObject("Scripting.FileSystemObject")
    'Change the file name and path on the next line'
    Set objFile = objFSO.CreateTextFile("C:\eetesting\Unresolved Addresses.csv", True)
    For Each olkRecipient In Outlook.ActiveInspector.CurrentItem.Recipients
        If olkRecipient.Resolved Then
            objFile.WriteLine Chr(34) & olkRecipient.Name & """,""Resolved"""
        Else
            objFile.WriteLine Chr(34) & olkRecipient.Name & """,""Unresolved"""
        End If
    Next
    objFile.Close
    Set objFile = Nothing
    Set objFSO = Nothing
    Set olkRecipient = Nothing
    MsgBox "Done"
End Sub

Open in new window

0
 
bsharathAuthor Commented:
Thanks David worked perfect...
0
 
David LeeCommented:
You're welcome.
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now