• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 717
  • Last Modified:

Change phone number format

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
sifenwick
Asked:
sifenwick
1 Solution
 
nutschCommented:
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now