I came across the code below to extract the contacts from a Distribution List in Outlook and place the values (Names and their corresponding email addresses) into a new worksheet in Excel. The script works perfectly in Excel for what it is designed to do. It got me to wondering if it could be redesigned to serve a different purpose within Outlook.

What I'm wanting to do is be able to click FORWARD when I receive an email from someone on my Distribution List (DL), and when I insert the name of my DL to the BCC field, I want it to be able to scan the DL and and send it to everyone on the list EXCEPT the person who sent it to me. How would this be accomplished?

Thanks,

Opv


[VBA]
Const olFolderContacts = 10

Sub DistList()
Dim objApp As Object, objNS As Object
Dim objFolder As Object, objDist As Object
Dim objAddrEntry As Object
Dim MyList As String
Dim ws As Worksheet

Set ws = ActiveWorkbook.Worksheets.Add

MyList = "MyList" ' change your list name here
Set objApp = CreateObject("Outlook.Application")
Set objNS = objApp.GetNamespace("MAPI")
Set objFolder = objNS.GetDefaultFolder(olFolderContacts)
On Error Resume Next
Set objDist = objFolder.Items(MyList)
On Error GoTo 0
If objDist Is Nothing Then
MsgBox "Distribution List doesn't exist", vbCritical
GoTo fastexit
End If

For i = 1 To objDist.MemberCount
Set objAddrEntry = objDist.GetMember(i).AddressEntry
Cells(i, 1) = objAddrEntry.Name
Cells(i, 2) = objAddrEntry.Address
Next
fastexit:
Set objFolder = Nothing
Set objApp = Nothing
End Sub

[/VBA]