Solved

Change phone number format

Posted on 2008-06-18
3
707 Views
Last Modified: 2013-12-25
I have all my phone numbers in the format:
+44 7738888888

But i need them to be as follows:
+44 (0) 7738888888
is there a VB script that will do this on my busness phone  / home Phone numbers.

I have 8 PCs to run this on so an script that can run on all the PCs with alittle doctoring would be a great help.
0
Comment
Question by:sifenwick
3 Comments
 
LVL 39

Accepted Solution

by:
nutsch earned 500 total points
ID: 21818581
try something like this, adapted from bluedevilfan. I'd save a copy of the address book first if I were you.
Private Sub updateContacts()
    Dim MyFolder As Outlook.MAPIFolder, _
        MyContact As Object
    Set MyFolder = Session.GetDefaultFolder(olFolderContacts)
    ' Loop through all of the items in the folder. And looks for area code that does not have (0), for example +670 723-3361 should be expressed it as  +670 (0) 723-3361
    For Each MyContact In MyFolder.Items
        If MyContact.Class = olContact Then
            If not InStr(MyContact.BusinessTelephoneNumber, "(0)") Then
                MyContact.MobileTelephoneNumber = Left(MyContact.BusinessTelephoneNumber, 4) & "(0) " & Right(MyContact.BusinessTelephoneNumber,len(MyContact.BusinessTelephoneNumber)-4)
                MyContact.Save
            End If
        End If
    Next
    Set MyContact = Nothing
    Set MyFolder = Nothing
End Sub

Open in new window

0

Featured Post

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

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

Sometimes Outlook might have problems sending a message. There may be various causes- corrupted PST, AV scanner etc. The message, instead of going to the Sent Items folder, sits in the Outbox indefinitely. To remove it you can use a free tool cal…
If you don't know how to downgrade, my instructions below should be helpful.
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…
CodeTwo Sync for iCloud (http://www.codetwo.com/sync-for-icloud?sts=6554) automatically synchronizes your Outlook 2016, 2013, 2010 or 2007 folders with iCloud folders available via iCloud Control Panel. This lets you automatically sync them with…

770 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