Solved

Modify Outlook Contact Telephone Numbers to Add a 9

Posted on 2009-04-06
12
310 Views
Last Modified: 2012-06-21
Hi all,

I have a problem where I am trying to find a way to use Cisco IP Softphone to dial the numbers held in Outlook 2003 contacts.  

The problem is Outlook has the numbers stored without a 9 at the beginning.  Is there a way to update ALL of the telephone numbers for ALL contacts so that the STD codes become prefixed with a 9. E.g. both (0114) and 0114 become 90114 and (07807) and 07807 become 907807.
Please note that some are local numbers so may not have an STD code although these could be added if they are a problem.
Also some are international numbers so have two leading zeros.

Many thanks!!
0
Comment
Question by:Howco
  • 7
  • 5
12 Comments
 
LVL 76

Expert Comment

by:David Lee
ID: 24076971
Hi, Howco.

Yes, it's possible to prefix the numbers with a 9.  It's unnecesary though.  Outlook follows the dialing rules set in Phone and Modem Options in the Cotnrol Panel.  One of the options you can set is the number to dial to get an outside line.  If you specify a 9 for both local and long distance numbers, then Outlook should insert the 9 for you when it dials.
0
 

Author Comment

by:Howco
ID: 24077246
Hi,
Thanks for your response.  However, it is Cisco IP telephony that is doing the dialling and there is no way to add a 9 in that app.
It just dials the number shown on the contact.
0
 
LVL 76

Expert Comment

by:David Lee
ID: 24077276
Ok.  I can provide a script that will isnert a 9 before all existing phone numbers.  Will that work?
0
Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

 

Author Comment

by:Howco
ID: 24077291
That would be great.  Thanks!
It would need to modify all held telephone numbers (Mobile, Business 1 etc) and need to be able to handle international and bracketed STD codes.
0
 
LVL 76

Expert Comment

by:David Lee
ID: 24077526
It will modify all existing phone numbers by inserting a 9 at the beginning of the number without regard to international and/or bracketed STD codes (whatever those are).  Correct?
0
 

Author Comment

by:Howco
ID: 24077612
Numbers (For me anyway) are listed as 0114 555666 etc or 009 855 446766.
However, some put brackets around the STD code e.g (0114) 555666.
These need to be converted to all look like 90114555666 or 9009855446766 (Although having spaces should be ok so don't worry about removing them)
Is that enough info?  
Many thanks!
0
 
LVL 76

Expert Comment

by:David Lee
ID: 24077782
So 9 as the left-most digit, and remove parenthesis and spaces if they exist.  Will that do it?
0
 

Author Comment

by:Howco
ID: 24086168
Yes that will be fantastic.  Many thanks!
0
 
LVL 76

Expert Comment

by:David Lee
ID: 24086594
Here's the code for doing this.
Sub FixPhoneNumbers()
    Dim olkContact As Object
    For Each olkContact In Outlook.Application.ActiveExplorer.CurrentFolder.Items
        If olkContact.Class = olContact Then
            With olkContact
                .AssistantTelephoneNumber = FixNumber(.AssistantTelephoneNumber)
                .Business2TelephoneNumber = FixNumber(.Business2TelephoneNumber)
                .BusinessTelephoneNumber = FixNumber(.BusinessTelephoneNumber)
                .CallbackTelephoneNumber = FixNumber(.CallbackTelephoneNumber)
                .CarTelephoneNumber = FixNumber(.CarTelephoneNumber)
                .CompanyMainTelephoneNumber = FixNumber(.CompanyMainTelephoneNumber)
                .Home2TelephoneNumber = FixNumber(.Home2TelephoneNumber)
                .HomeTelephoneNumber = FixNumber(.HomeTelephoneNumber)
                .MobileTelephoneNumber = FixNumber(.MobileTelephoneNumber)
                .OtherTelephoneNumber = FixNumber(.OtherTelephoneNumber)
                .PagerNumber = FixNumber(.PagerNumber)
                .PrimaryTelephoneNumber = FixNumber(.PrimaryTelephoneNumber)
                .RadioTelephoneNumber = FixNumber(.RadioTelephoneNumber)
                .TelexNumber = FixNumber(.TelexNumber)
                .TTYTDDTelephoneNumber = FixNumber(.TTYTDDTelephoneNumber)
                .Save
            End With
        End If
    Next
    Set olkContact = Nothing
    MsgBox "Done"
End Sub
 
Function FixNumber(strNumber As String) As String
    If strNumber <> "" Then
        FixNumber = Replace(strNumber, "(", "")
        FixNumber = Replace(FixNumber, ")", "")
        FixNumber = Replace(FixNumber, " ", "")
        FixNumber = "9" & FixNumber
    End If
End Function

Open in new window

0
 
LVL 76

Accepted Solution

by:
David Lee earned 500 total points
ID: 24086611
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 folder containing the contacts you want to run this against
11.  Run the macro FixPhoneNumbers

I recommend running this against a folder with some test contact first to make sure it works properly before running it against your full contacts folder.
0
 

Author Closing Comment

by:Howco
ID: 31566971
You are without doubt 'The man' or woman as You never specified :o)

Many thanks, it worked perfectly.  The only change I made was to add

FixNumber = Replace(FixNumber, "+44", "0")

Cheers!!!
0
 
LVL 76

Expert Comment

by:David Lee
ID: 24087259
Thanks and you're welcome.  Glad I could help.  Cheers!
0

Featured Post

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

Question has a verified solution.

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

MS Outlook is a world-class email client application that is mainly used for e-communication globally.  In this article, we will discuss the basic idea about MS Outlook, its advanced features, and types of MS Outlook File formats.
Large Outlook files lead to various unwanted errors and corruption issues. Furthermore, large outlook files can also make Outlook take longer to start-up, search, navigate, and shut-down. So, In this article, i will discuss a method to make your Out…
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…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

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