M
mac7attack
Hello all,
I need to write a VBA script that will export the members of a Exchange
Distribution List into a CSV (or a semicolon delimited txt). I did find
the following code snippet from Microsoft that runs in a cmd shell.
Could someone please help me convert this into a valid VBA script to
export the list in Excel?
I am running Outlook 2003 in a Windows 2000 enviroment with Exchange
2000. (don't ask me why.)
Thanks
Matt
[Code}
Const olFolderContacts = 10
Set objOutlook = CreateObject("Outlook.Application")
Set objNamespace = objOutlook.GetNamespace("MAPI")
Set colContacts = objNamespace.GetDefaultFolder(olFolderContacts).Items
intcount = colContacts.Count
For i = 1 To intcount
If TypeName(colContacts.Item(i)) = "DistListItem" Then
Set objDistList = colContacts.Item(i)
Wscript.Echo objDistList.DLName
For j = 1 To objDistList.MemberCount
Wscript.Echo objDistList.GetMember(j).Name & " -- " & _
objDistList.GetMember(j).Address
Next
Wscript.Echo
End If
Next
[End Code}
I need to write a VBA script that will export the members of a Exchange
Distribution List into a CSV (or a semicolon delimited txt). I did find
the following code snippet from Microsoft that runs in a cmd shell.
Could someone please help me convert this into a valid VBA script to
export the list in Excel?
I am running Outlook 2003 in a Windows 2000 enviroment with Exchange
2000. (don't ask me why.)
Thanks
Matt
[Code}
Const olFolderContacts = 10
Set objOutlook = CreateObject("Outlook.Application")
Set objNamespace = objOutlook.GetNamespace("MAPI")
Set colContacts = objNamespace.GetDefaultFolder(olFolderContacts).Items
intcount = colContacts.Count
For i = 1 To intcount
If TypeName(colContacts.Item(i)) = "DistListItem" Then
Set objDistList = colContacts.Item(i)
Wscript.Echo objDistList.DLName
For j = 1 To objDistList.MemberCount
Wscript.Echo objDistList.GetMember(j).Name & " -- " & _
objDistList.GetMember(j).Address
Next
Wscript.Echo
End If
Next
[End Code}