|
-
Sep 28th, 2012, 05:51 PM
#1
Thread Starter
New Member
Is there ANYTHING wrong with this code?
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
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|