Solved

Change phone number format

Posted on 2008-06-18
3
704 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
Comment Utility
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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Follow this checklist to learn more about the 15 things you should never include in an email signature from personal quotes, animated gifs and out-of-date marketing content.
This process describes the steps required to Import and Export data from and to .pst files using Exchange 2010. We can use these steps to export data from a user to a .pst file, import data back to the same or a different user, or even import data t…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

772 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now