Hi Michal,
I appreciate your time on the macro, but I'm not sure that is going to do
what we wanted. We don't necessarily want to append a 1+ to all our
contacts. We only want that to happen if it's long distance based on the
phone/modem settings. (As outlook should on it's own, and does with new
entries.)
"Michal [Outlook MVP]" wrote:
You can try the below macro. It worked ok for Polish users, I made necessary
changes to make it working with +1 prefix, but I didn't test it. So, first
better run it on a small number of temporary contacts.
Sub CountryPrefix()
Dim oFolder As MAPIFolder
Set oFolder = Application.ActiveExplorer.CurrentFolder
If Left(UCase(oFolder.DefaultMessageClass), 11) "IPM.CONTACT" Then
MsgBox "Select contact folder", vbExclamation
Exit Sub
End If
Dim nCounter As Integer
nCounter = 0
Dim oItem
For Each oItem In oFolder.Items
Dim oContact As ContactItem
Set oContact = oItem
If Not oContact Is Nothing Then
With oContact
.AssistantTelephoneNumber = AddPrefix(.AssistantTelephoneNumber)
.Business2TelephoneNumber = AddPrefix(.Business2TelephoneNumber)
.BusinessFaxNumber = AddPrefix(.BusinessFaxNumber)
.BusinessTelephoneNumber = AddPrefix(.BusinessTelephoneNumber)
.CallbackTelephoneNumber = AddPrefix(.CallbackTelephoneNumber)
.CarTelephoneNumber = AddPrefix(.CarTelephoneNumber)
.CompanyMainTelephoneNumber = AddPrefix(.CompanyMainTelephoneNumber)
.Home2TelephoneNumber = AddPrefix(.Home2TelephoneNumber)
.HomeFaxNumber = AddPrefix(.HomeFaxNumber)
.HomeTelephoneNumber = AddPrefix(.HomeTelephoneNumber)
.ISDNNumber = AddPrefix(.ISDNNumber)
.MobileTelephoneNumber = AddPrefix(.MobileTelephoneNumber)
.OtherFaxNumber = AddPrefix(.OtherFaxNumber)
.OtherTelephoneNumber = AddPrefix(.OtherTelephoneNumber)
.PagerNumber = AddPrefix(.PagerNumber)
.PrimaryTelephoneNumber = AddPrefix(.PrimaryTelephoneNumber)
.RadioTelephoneNumber = AddPrefix(.RadioTelephoneNumber)
.TelexNumber = AddPrefix(.TelexNumber)
.TTYTDDTelephoneNumber = AddPrefix(.TTYTDDTelephoneNumber)
.Save
nCounter = nCounter + 1
End With
End If
Next
MsgBox nCounter & " contacts processed.", vbInformation
End Sub
Private Function AddPrefix(strPhone As String) As String
AddPrefix = strPhone
strPhone = Trim(strPhone)
If strPhone = "" Then Exit Function
If Left(strPhone, 1) = "+" Then Exit Function
If Left(strPhone, 2) = "(+" Then Exit Function
If Left(strPhone, 2) = "00" Then Exit Function
If Left(strPhone, 3) = "(00" Then Exit Function
If Left(strPhone, 1) = "1" Then Exit Function
If Left(strPhone, 2) = "(1" Then Exit Function
AddPrefix = "1" + strPhone
End Function
--
Best regards,
Michal [Microsoft Outlook MVP]
http://www.codetwo.com
Share Outlook on the net without Exchange!
NewtoExpressionWeb wrote:
We have an interesting outlook contact phone number display issue.
We have programmed our Phone and Modem settings to include rules for phone
number prefixes within our area code that require long distance information.
(1+areacode) When adding a new contact everything displays great. For
example.... 1 (999) 999-9999 Etc...
Existing contacts before the rules however, still display as either (999)
999-9999 or worse 999-9999. Opening the contact and clicking the phone
number button fixes it, but with some users having hundreds-thousands of
contacts that is kind of an un-reasonable approach. All contacts are stored
in Exchange as the back-end.
Funny note: If you click the "dial" button, the number dials correctly even
though the display is wrong.
Is there a way to have the contacts DISPLAY properly without having the
users edit each one? Will export, delete all, import work? What are the
chances for data loss doing that? (Some users have information in a LOT of
fields.)
Thanks in advance for any help...
D