alarian
09-28-2012, 03:42 PM
Sub ReFileContacts()
On Error GoTo ErrHandler:
Dim items As items, item As ContactItem, folder As folder
Dim contactItems As Outlook.items
Dim itemContact As Outlook.ContactItem
Dim Count As Long
Set folder = Session.GetDefaultFolder(olFolderContacts)
Set items = folder.items
Count = items.Count
If Count = 0 Then
MsgBox "Nothing to do!"
Exit Sub
End If
'Filter on the message class to obtain only contact items in the folder
Set contactItems = items.Restrict("[MessageClass]='IPM.Contact'")
For Each itemContact In contactItems 'Loop through all contacts
itemContact.Email1Address = LCase(Trim(Replace(itemContact.Email1Address, " ", "")))
itemContact.Save 'Save the contact
Next
MsgBox "Your contacts have been converted to lowercase without whitespaces."
Exit Sub
ErrHandler:
MsgBox (itemContact.Email1Address)
Resume Next
End Sub
I'm having issues with a client... Going through an arbitration
Is there anything that should prevent this from running?
Please try it out, say if you get any errors
On Error GoTo ErrHandler:
Dim items As items, item As ContactItem, folder As folder
Dim contactItems As Outlook.items
Dim itemContact As Outlook.ContactItem
Dim Count As Long
Set folder = Session.GetDefaultFolder(olFolderContacts)
Set items = folder.items
Count = items.Count
If Count = 0 Then
MsgBox "Nothing to do!"
Exit Sub
End If
'Filter on the message class to obtain only contact items in the folder
Set contactItems = items.Restrict("[MessageClass]='IPM.Contact'")
For Each itemContact In contactItems 'Loop through all contacts
itemContact.Email1Address = LCase(Trim(Replace(itemContact.Email1Address, " ", "")))
itemContact.Save 'Save the contact
Next
MsgBox "Your contacts have been converted to lowercase without whitespaces."
Exit Sub
ErrHandler:
MsgBox (itemContact.Email1Address)
Resume Next
End Sub
I'm having issues with a client... Going through an arbitration
Is there anything that should prevent this from running?
Please try it out, say if you get any errors