PDA

View Full Version : How to filter contact and distribution list



yurble_vn
06-07-2008, 08:27 AM
Dear All,

I recently find the contact management of MS outlook is very useful.
I have used it as a soft copy of all my contact book.

And sometime print it out. But what I found limited, so I write here to look for help :
1. The first point is the distribution list vs. contact. Is there anywhy to filter the distribution list so contact book just show real contact. From the "customize current view", I found there are a lot of field,but I did not find the field that help to distinguish between distribution list and contact.
2. Company management: is there anyway to manage the company information?
For example: I have 30 contacts at the same company. Everytime the company change the address, I have to change one by one all of these 30 contacts.

Thanks all in advance.
Regards,

Charlize
06-19-2008, 03:15 AM
Do you mean the addresses in the distribution list ?

Charlize

yurble_vn
06-19-2008, 09:16 AM
Let I say more about my troubles:
1. In the address (or contact) in MS outlook, sometimes, I just need to see and print the contact, but not the distribution list. In MS Outlook, I find there is the filter to filter what we want to see, but I dont know how to filter contact out of distribution list.

2. Also in the contact, there are some contacts of the same company, and is there any way to let MS outlook manage it?
For example, when I change the address of the company, all the contact of that company must be changed accordingly.

Thanks for your answer

Charlize
06-20-2008, 12:30 AM
Something like this ?Sub Alter_Mails_For_Company()
'Holds the searchstring
Dim mycompany As String
'Create a message to display
Dim myresult As String
Dim mycontact As Outlook.ContactItem
Dim myfolder As Outlook.MAPIFolder
'Type the exact name of the company
'that is filled in for the field company
'of every contact
mycompany = InputBox("Give Companyname to list contacts from.", _
"Get contacts of certain Company.")
'Get default folder that you use for contacts
Set myfolder = Application.Session.GetDefaultFolder(olFolderContacts)
'If you use distribution lists, you'll get an error
'so we skip and continue with the next contact
On Error Resume Next
For Each mycontact In myfolder.Items
'The company of the addressentry = searchstring
If mycontact.CompanyName = mycompany Then
myresult = myresult & mycontact.FullName & vbCrLf
End If
Next mycontact
'Restore the errortrapping
On Error GoTo 0
If myresult <> "" Then
MsgBox "Contacts for " & mycompany & " :" & vbCrLf & myresult, vbInformation
Else
MsgBox "No contacts found for " & mycompany, vbInformation
End If
End SubCharlize

Charlize
06-23-2008, 02:48 AM
This variation will check if an item in your contactsfolder is a contact or a distributionlist.Sub Distribution_or_not()
Dim myfolder As Outlook.MAPIFolder
Dim vloop As Long
Set myfolder = Application.Session.GetDefaultFolder(olFolderContacts)
For vloop = 1 To myfolder.Items.Count
'Check if the class of an item is contact, distribution
'or something else
If myfolder.Items(vloop).Class = olContact Then
MsgBox myfolder.Items(vloop).FullName & " is a contact."
ElseIf myfolder.Items(vloop).Class = olDistributionList Then
MsgBox myfolder.Items(vloop) & " is a distributionlist."
Else
MsgBox myfolder.Items(vloop) & " isn't a" & vbCrLf & _
"contact or distributionlist"
End If
Next vloop
End SubCharlize

Charlize
07-02-2008, 02:26 AM
Variation on checking persons that work for a certain company. The previous example didn't worked all the time (don't know the reason - perhaps the for each loop ?). This version seems to do what I want it to do.Sub List_Possible_Companys()
Dim myfolder As Outlook.MAPIFolder
Dim mycontact As Outlook.ContactItem
Dim mycompany As String
Dim myresult As String
Dim vloop As Long
mycompany = InputBox("Give Companyname to list contacts from.", _
"Get contacts of certain Company.")
Set myfolder = Application.Session.GetDefaultFolder(olFolderContacts)
For vloop = 1 To myfolder.Items.Count
If myfolder.Items(vloop).Class = olContact Then
Set mycontact = myfolder.Items(vloop)
If mycontact.CompanyName <> vbNullString Then
If mycontact.CompanyName = mycompany Then
myresult = myresult & "- " & mycontact.FullName & vbCrLf
End If
End If
End If
Next vloop
If myresult <> vbNullString Then
MsgBox "People that work for " & mycompany & " :" & _
vbCrLf & myresult, vbInformation
ElseIf mycompany <> vbNullString Then
MsgBox "No one found for : " & mycompany, vbInformation
Else
MsgBox "No search criteria was specified ...", vbInformation
End If
End SubCharlize