Macro to update imported contacts

  • Thread starter Thread starter Faraz A. Qureshi
  • Start date Start date
F

Faraz A. Qureshi

Upon transfer of my contacts from a cell to the Outlook contacts I have found
that the numbers are not being displayed in full and the country code is
missing.

Any idea/macro how to have all the contact numbers have a country code "+92"
(Pakistan) be inserted in all in a single go?

Thanx in advance.
 
Please show the code you're using the set the value of the ContactItem phone
number properties.
 
I don't have any. In fact, that is what I am looking for!
--
Do check "Yes" if this post is helpful,
Best Regards,

Faraz


Sue Mosher said:
Please show the code you're using the set the value of the ContactItem phone
number properties.
 
Between the code samples listed at
http://www.outlookcode.com/article.aspx?ID=23 and the object browser (F2 in
VBA) to give you the names of fields, you should have everything you need to
put this together to meet your specific requirements.

--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54


Faraz A. Qureshi said:
I don't have any. In fact, that is what I am looking for!
--
Do check "Yes" if this post is helpful,
Best Regards,

Faraz
 
Sorry Sue,

Tried my level best but can't achieve/develop the required code. Can you
simply devise a code to change or add country code "+92" to all the existing
contacts' mobile/home office numbers?

--
Best Regards,

Faraz
 
It's very hard to help you figure you where you're going wrong unless you
share the code you've written and indicate where you have encountered
problems.

You might compare this with what you already have:

On Error Resume Next
Set objFolder = Application.session.GetDefaultFolder(olFolderContacts)
If Not objFolder Is Nothing Then
Set objItems = objFolder.Items
For Each objItem In objItems
' make sure you have a Contact item
If objItem.Class = olContact Then
Set objContact = objItem
With objContact
.MobileTelephoneNumber = _
"+92 " & objContact.MobileTelephoneNumber
.BusinessTelephoneNumber = _
"+92 " & objContact.MobileTelephoneNumber
.Save
Next
End If
End If


--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54
 
Thanx for all your help Sue,

The code works well enough! However, I did get to manage the same by
exporting the contacts to *.csv, inserting "+92 " to all via concatenating
and and then re-importing the same file.

Thanx again 4 all your help, I really appreciate the same!

--
Best Regards,

Faraz
 
Back
Top