kool Posted March 3, 2012 Posted March 3, 2012 I am using Outlook 2007 VBA and I'm trying to filter out DistList items from my contacts folder. I'm using the following code: Public contactFolder As Outlook.MAPIFolder = _ olNameSpace.GetDefaultFolder( _ Outlook.OlDefaultFolders.olFolderContacts) Public MyContacts As Outlook.Items = contactFolder.Items.Restrict("[MessageClass] = ‘IPM.Contact’") lstBoxContacts.Clear() For Each contact As Outlook.ContactItem In MyContacts If Not IsNothing(MyContacts(Ndx).Email1Address) Then lstBoxContacts.Add(MyContacts(Ndx).FullName & " | " & MyContacts(Ndx).Email1Address) End If NextI put a breakpoint at the "For Each" statement. When I checked the "MyContacts" collection it shows as empty. Can anyone tell me why that is. If I take the "Restrict" part off of the "Public MyContacts" line, the collection is not empty.
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now