Outlook Banter

Outlook Banter (http://www.outlookbanter.com/)
-   Outlook and VBA (http://www.outlookbanter.com/outlook-vba/)
-   -   move phone numbers from company field to business field (http://www.outlookbanter.com/outlook-vba/17308-move-phone-numbers-company-field.html)

Tyson June 9th 06 03:27 AM

move phone numbers from company field to business field
 
Hello-

I need to move the phone numbers from the 'company' field to the 'business'
field for approximately 800 contacts.

not all contacts have a number in the 'company' field.

the company field should be blank after the move.

please help.

Thanks,

Tyson

Michael Bauer June 9th 06 05:30 AM

move phone numbers from company field to business field
 
Am Thu, 8 Jun 2006 19:27:01 -0700 schrieb Tyson:

Tyson, this sample should do it:

Public Sub ExportContactsAsVCard()
Dim obj As Object
Dim Contact as Outlook.ContactItem
Dim Items As Outlook.Items

Set Items = Application.Session.GetDefaultFolder(olFolderConta cts).Items
For Each obj In Items
If TypeOf obj Is Outlook.ContactItem Then
Set Contact=obj
Contact.BusinessTelephoneNumber=Contact.CompanyMai nTelephoneNumber
Contact.CompanyMainTelephoneNumber=vbNullString
Contact.Save
End If
Next
End Sub


--
Viele Gruesse / Best regards
Michael Bauer - MVP Outlook
-- www.vbOffice.net --


Hello-

I need to move the phone numbers from the 'company' field to the

'business'
field for approximately 800 contacts.

not all contacts have a number in the 'company' field.

the company field should be blank after the move.

please help.

Thanks,

Tyson


Tyson June 9th 06 04:04 PM

move phone numbers from company field to business field
 
Michael-

Thanks for the code. Unfortunately, I forgot to mention that some contacts
already have a number in the 'business phone' field - this code overwrites
those numbers when the 'company phone' field is blank.

How to check for that before overwriting?

Tyson



"Michael Bauer" wrote:

Am Thu, 8 Jun 2006 19:27:01 -0700 schrieb Tyson:

Tyson, this sample should do it:

Public Sub ExportContactsAsVCard()
Dim obj As Object
Dim Contact as Outlook.ContactItem
Dim Items As Outlook.Items

Set Items = Application.Session.GetDefaultFolder(olFolderConta cts).Items
For Each obj In Items
If TypeOf obj Is Outlook.ContactItem Then
Set Contact=obj
Contact.BusinessTelephoneNumber=Contact.CompanyMai nTelephoneNumber
Contact.CompanyMainTelephoneNumber=vbNullString
Contact.Save
End If
Next
End Sub


--
Viele Gruesse / Best regards
Michael Bauer - MVP Outlook
-- www.vbOffice.net --


Hello-

I need to move the phone numbers from the 'company' field to the

'business'
field for approximately 800 contacts.

not all contacts have a number in the 'company' field.

the company field should be blank after the move.

please help.

Thanks,

Tyson



-mhd June 9th 06 05:38 PM

move phone numbers from company field to business field
 
Tyson wrote:

How to check for that before overwriting?


Use the Len function to see if the field contains data.

-mhd


All times are GMT +1. The time now is 06:18 AM.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2006 OutlookBanter.com