![]() |
|
#1
|
|||
|
|||
|
Hi
I have send emails out to my adress book using my groups instead of sending it individually. There are people that want to unsubscribe. How do I find in which group the specific contact is without searching each group manually? I have like 30 groups with about 80 adress in each. You can imagine how long that is going to take manually. Please respond Thank you Wikus |
|
#2
|
||||
|
||||
|
The following macro will list the groups a named member appears in:
Code:
Sub ListDistributionGroupNamesContainingMember()
Dim olNameSpace As Outlook.NameSpace
Dim olFolder As Outlook.Folder
Dim olDistList As Outlook.DistListItem
Dim olFolderItems As Outlook.Items
Dim olListMember As String
Dim sList As String
Dim x As Integer
Dim y As Integer
Dim iCount As Integer
olListMember = LCase(InputBox("Enter name of list member to be found", _
"Find name in Distribution Lists"))
Set olNameSpace = GetNamespace("MAPI")
Set olFolder = olNameSpace.GetDefaultFolder(olFolderContacts)
Set olFolderItems = olFolder.Items
iCount = olFolderItems.Count
sList = ""
For x = 1 To iCount
If TypeName(olFolderItems.Item(x)) = "DistListItem" Then
Set olDistList = olFolderItems.Item(x)
For y = 1 To olDistList.MemberCount
If InStr(1, olDistList.GetMember(y).Name, olListMember) Then
If sList = "" Then
sList = sList & olDistList.GetMember(y).Name _
& Chr(32) & ChrW(8212) & Chr(32) & olDistList.DLName
Else
sList = sList & vbCr & olDistList.GetMember(y).Name _
& Chr(32) & ChrW(8212) & Chr(32) & olDistList.DLName
End If
End If
Next y
End If
Next x
MsgBox sList
lbl_Exit:
Exit Sub
End Sub
__________________
Graham Mayor - MS MVP (Word) (2002-2019) Visit my web site for more programming tips and ready made processes www.gmayor.com |
|
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Syncing selected contacts between "Contacts" list and "Business Contacts" | Derick Sturke | Outlook | 0 | 05-29-2014 03:52 PM |
| Copy Excel sheet (contacts) to Outlook Contacts using VBA | szchris384 | Outlook | 0 | 03-01-2014 05:48 PM |
| import public contacts to local contacts | nickl | Outlook | 2 | 09-16-2011 05:22 AM |
How to automatic save Sending or replying contacts e-mails into contacts?
|
biologus | Outlook | 1 | 09-12-2011 01:14 PM |
| Two Contacts, Same Address! Mail merging married contacts?!! | tomtomlo | Outlook | 0 | 03-26-2008 03:21 PM |