Reputation: 8646
I need to address a Contact Group of my Outlook. Right now I have to go through all the items in my Contacts:
Set ContactsFolder = Application.Session.GetDefaultFolder(olFolderContacts)
Set contactItems = ContactsFolder.Items
iCount = contactItems.Count
For i = 1 To iCount
Set thisItem = contactItems.Item(i)
If TypeName(thisItem) = "DistListItem" And thisItem = "promo_spam" Then
Set myDLGroup = thisItem
Exit For
End If
Next i
is there any better way to get it? I was thinking about something like ContactsFolder.Items.Find but couldn't find the right way to use it...
Upvotes: 1
Views: 96
Reputation: 9199
The code you are using is normally for listing items in a group.
If you already know the name then:
Set myDLGroup = contactItems("promo_spam")
Upvotes: 1