?
Solved

Normalizing Phone Numbers in Outlook Contacts

Posted on 2010-01-01
10
Medium Priority
?
977 Views
Last Modified: 2012-05-08
I have a very Pesky customer that would now like to have all of his Outlook phone numbers look the same.  A lot of the numbers are imports from Act, other contact lists etc.  So some of them are formatted as xxxxxxxxxx, some xxx-xxx-xxxx and others the way he'd like to see them (xxx) xxx-xxxx.  The settings in the modem and dialing options are correct and newly entered numbers are fine, it's just all of the old numbers that are the issue.  The only way I know how to fix this would be to manually enter each contact and erase a single number of the phone number and retype it which will automatically format correctly.

Outlook is 2007 and Windows is XP Pro.

Thanks
0
Comment
Question by:Fluid_Imagery
10 Comments
 
LVL 11

Expert Comment

by:ICaldwell
ID: 26158470
You can use Outlook Tools to do this... Its a free download:

http://www.softwarelode.com/31978/details-outlook-tools.html
0
 
LVL 76

Expert Comment

by:David Lee
ID: 26162721
Hi, Fluid_Imagery.

The code below should fix all the numbers.  Follow these instructions to use it.

1.  Start Outlook
2.  Click Tools > Macro > Visual Basic Editor
3.  If not already expanded, expand Microsoft Office Outlook Objects
4.  If not already expanded, expand Modules
5.  Select an existing module (e.g. Module1) by double-clicking on it or create a new module by right-clicking Modules and selecting Insert > Module.
6.  Copy the code from the Code Snippet box and paste it into the right-hand pane of Outlook's VB Editor window
7.  Edit the code as needed.  I included comments wherever something needs to or can change
8.  Click the diskette icon on the toolbar to save the changes
9.  Close the VB Editor
10. Select the Contact folder to process
11. Run the macro

I recommend backing the contact up before running the code just in case.
0
 
LVL 76

Expert Comment

by:David Lee
ID: 26162736
I don't know what happened to the code.  Let's try this again.
Sub FormatPhoneNumbers()
    Const PHONE_FIELDS = "AssistantTelephoneNumber,Business2TelephoneNumber,BusinessFaxNumber,BusinessTelephoneNumber,CallbackTelephoneNumber,CarTelephoneNumber,Home2TelephoneNumber,HomeFaxNumber,HomeTelephoneNumber,ISDNNumber,MobileTelephoneNumber,OtherFaxNumber,OtherTelephoneNumber,PagerNumber,PrimaryTelephoneNumber,RadioTelephoneNumber,TelexNumber,TTYTDDTelephoneNumber"
    Dim olkFolder As Outlook.Folder, _
        olkContact As Outlook.contactItem, _
        olkProp As Outlook.ItemProperty, _
        arrNumbers As Variant, _
        varNumber As Variant, _
        strTemp As String
    arrNumbers = Split(PHONE_FIELDS, ",")
    Set olkFolder = Application.ActiveExplorer.CurrentFolder
    For Each olkContact In olkFolder.Items
        For Each varNumber In arrNumbers
            Set olkProp = olkContact.ItemProperties(varNumber)
            olkProp.Value = olkProp.Value
            olkContact.Save
        Next
    Next
    Set olkContact = Nothing
    Set olkFolder = Nothing
    msgbox "All done!"
End Sub

Open in new window

0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 

Author Comment

by:Fluid_Imagery
ID: 26187625
BlueDevil,

I'm getting a type mismatch error when I try to run the script (runtime error 13).  Any ideas?
0
 
LVL 76

Expert Comment

by:David Lee
ID: 26188877
My fault.  I forgot to check for and exclude distribution lists.  Please try this version.
Sub FormatPhoneNumbers()
    Const PHONE_FIELDS = "AssistantTelephoneNumber,Business2TelephoneNumber,BusinessFaxNumber,BusinessTelephoneNumber,CallbackTelephoneNumber,CarTelephoneNumber,Home2TelephoneNumber,HomeFaxNumber,HomeTelephoneNumber,ISDNNumber,MobileTelephoneNumber,OtherFaxNumber,OtherTelephoneNumber,PagerNumber,PrimaryTelephoneNumber,RadioTelephoneNumber,TelexNumber,TTYTDDTelephoneNumber"
    Dim olkFolder As Outlook.Folder, _
        olkItem As Object, _
        olkProp As Outlook.ItemProperty, _
        arrNumbers As Variant, _
        varNumber As Variant, _
        strTemp As String
    arrNumbers = Split(PHONE_FIELDS, ",")
    Set olkFolder = Application.ActiveExplorer.CurrentFolder
    For Each olkItem In olkFolder.Items
        If olkItem.Class = olContact Then
            For Each varNumber In arrNumbers
                Set olkProp = olkContact.ItemProperties(varNumber)
                olkProp.Value = olkProp.Value
                olkContact.Save
            Next
        End If
    Next
    Set olkItem = Nothing
    Set olkFolder = Nothing
    msgbox "All done!"
End Sub

Open in new window

0
 

Author Comment

by:Fluid_Imagery
ID: 26191273
Runtime error 424 Object Required.
0
 

Author Comment

by:Fluid_Imagery
ID: 26191281
if it helps, it's pointing to the
"Set olkProp = olkContact.ItemProperties(varNumber) "  line
0
 
LVL 76

Accepted Solution

by:
David Lee earned 2000 total points
ID: 26193678
Try this.
Sub FormatPhoneNumbers() 
    Const PHONE_FIELDS = "AssistantTelephoneNumber,Business2TelephoneNumber,BusinessFaxNumber,BusinessTelephoneNumber,CallbackTelephoneNumber,CarTelephoneNumber,Home2TelephoneNumber,HomeFaxNumber,HomeTelephoneNumber,ISDNNumber,MobileTelephoneNumber,OtherFaxNumber,OtherTelephoneNumber,PagerNumber,PrimaryTelephoneNumber,RadioTelephoneNumber,TelexNumber,TTYTDDTelephoneNumber" 
    Dim olkFolder As Outlook.Folder, _ 
        olkItem As Object, _ 
        olkProp As Outlook.ItemProperty, _ 
        arrNumbers As Variant, _ 
        varNumber As Variant, _ 
        strTemp As String 
    arrNumbers = Split(PHONE_FIELDS, ",") 
    Set olkFolder = Application.ActiveExplorer.CurrentFolder 
    For Each olkItem In olkFolder.Items 
        If olkItem.Class = olContact Then 
            For Each varNumber In arrNumbers 
                Set olkProp = olkItem.ItemProperties(varNumber) 
                olkProp.Value = olkProp.Value 
                olkItem.Save 
            Next 
        End If 
    Next 
    Set olkItem = Nothing 
    Set olkFolder = Nothing 
    msgbox "All done!" 
End Sub

Open in new window

0
 

Expert Comment

by:Waident
ID: 29953564
Just an FYI - I had this same problem and was going to use this VBA script but instead tried an easier method (for me at least).  I exported all the contacts out of outlook, deleted them all from the contacts folder, and reimported them back in and they all came up with the (xxx) xxx-xxxx format.  

Cheers!
0
 

Expert Comment

by:BTCTechXperts
ID: 37441447
To expand on Waident's much eaiser solution; just make sure you export to CSV(DOS) instead of PST, otherwise it will not reformat the phone numbers for you.
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Take a look at these 6 Outlook Email management tools which can augment the working and performance of Microsoft Outlook to give you a more rewarding emailing experience.
Mailbox Corruption is a nightmare every Exchange DBA wishes he never has. Recovering from it can be super-hectic if not entirely futile. And though techniques like the New-MailboxRepairRequest cmdlet have been designed to help with fixing minor corr…
Many of my clients call in with monstrous Gmail overloading issues with Outlook. A quick tip is to turn off the All Mail and Important folders from synching. Here is a quick video I made to show you how to turn off these and other folders in Gmail s…
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…
Suggested Courses

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question