kool Posted March 3, 2012 Share 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. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now