S
skk
Hi! I'm trying to add phone # to Outlook Contact and it works good except
with phone # format is "123-4567". Many different ph# format works fine
(like (999)666-8888, x1234 etc.,)
Error example: Business (323243) 123-4567
strPhone (value shows, 123-4467) - correct value
ciContact.BusinessTelephoneNumber (value shows, (323243) 123-4567) -put junk
in the front
Thanks in advance. codes are below:
Public Sub OpenOutlookContact(strFullName As String, strEmail As String,
strPhone As String)
' Open a Microsoft Outlook contact for the specified name.
Dim appOutlook As New Outlook.Application
Dim nsOutlook As NameSpace
Dim mfContacts As MAPIFolder
Dim ciContact As ContactItem
' Open the Outlook default Contacts folder.
Set nsOutlook = appOutlook.GetNamespace("MAPI")
Set mfContacts = nsOutlook.GetDefaultFolder(olFolderContacts)
' Find the contact named in the AssignedTo column.
Set ciContact = mfContacts.Items.Find("[FullName] = " & strFullName)
' If the contact doesn't exist, create a new contact.
If ciContact Is Nothing Then
Set ciContact = mfContacts.Items.Add
ciContact.FullName = strFullName
ciContact.Email1Address = strEmail
ciContact.BusinessTelephoneNumber = strPhone
End If
' Open the Outlook contact window.
ciContact.Display
End Sub
with phone # format is "123-4567". Many different ph# format works fine
(like (999)666-8888, x1234 etc.,)
Error example: Business (323243) 123-4567
strPhone (value shows, 123-4467) - correct value
ciContact.BusinessTelephoneNumber (value shows, (323243) 123-4567) -put junk
in the front
Thanks in advance. codes are below:
Public Sub OpenOutlookContact(strFullName As String, strEmail As String,
strPhone As String)
' Open a Microsoft Outlook contact for the specified name.
Dim appOutlook As New Outlook.Application
Dim nsOutlook As NameSpace
Dim mfContacts As MAPIFolder
Dim ciContact As ContactItem
' Open the Outlook default Contacts folder.
Set nsOutlook = appOutlook.GetNamespace("MAPI")
Set mfContacts = nsOutlook.GetDefaultFolder(olFolderContacts)
' Find the contact named in the AssignedTo column.
Set ciContact = mfContacts.Items.Find("[FullName] = " & strFullName)
' If the contact doesn't exist, create a new contact.
If ciContact Is Nothing Then
Set ciContact = mfContacts.Items.Add
ciContact.FullName = strFullName
ciContact.Email1Address = strEmail
ciContact.BusinessTelephoneNumber = strPhone
End If
' Open the Outlook contact window.
ciContact.Display
End Sub