View Single Post
  #10  
Old August 22nd 06, 06:24 AM posted to microsoft.public.outlook.contacts,microsoft.public.outlook.program_vba
Eric Legault [MVP - Outlook]
external usenet poster
 
Posts: 830
Default displaying international format phone numbers

Try this, but make sure to set a breakpoint on the Save line and do not
proceed with saving until you've verified that this Format function is
changing the phone number as you'd expect. If ANY phone numbers don't meet
the expected +########### format, they get all messed up.

Sub ChangeTelFormat()
Dim objC As Outlook.ContactItem
Dim strX As String

If ActiveExplorer.Selection.Count = 0 Then Exit Sub
If ActiveExplorer.CurrentFolder.DefaultItemType olContactItem Then
Exit Sub

For Each objC In ActiveExplorer.Selection
strX = Format(objC.BusinessTelephoneNumber, "+1 (@@@) @@@-@@@@")
objC.BusinessTelephoneNumber = strX
objC.Save
Next

Set objC = Nothing
End Sub

--
Eric Legault (Outlook MVP, MCDBA, MCTS: Messaging & Collaboration)
Try Picture Attachments Wizard for Outlook:
http://www.collaborativeinnovations.ca
Blog: http://blogs.officezealot.com/legault/


"stef" wrote:

Eric Legault [MVP - Outlook] wrote:
Yes, but you'd also of course need to declare the variables:

Dim objC As Outlook.ContactItem
Dim strX As String

Eric,
i must be doing something wrong as i'm getting an error message....
is there anyway i can get u to just spell it out for me out here, from
beginning to end?
that wd be most helpful.

Ads