A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

move phone numbers from company field to business field



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old June 9th 06, 03:27 AM posted to microsoft.public.outlook.program_vba
Tyson
external usenet poster
 
Posts: 17
Default 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
Ads
  #2  
Old June 9th 06, 05:30 AM posted to microsoft.public.outlook.program_vba
Michael Bauer
external usenet poster
 
Posts: 435
Default 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

  #3  
Old June 9th 06, 04:04 PM posted to microsoft.public.outlook.program_vba
Tyson
external usenet poster
 
Posts: 17
Default 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


  #4  
Old June 9th 06, 05:38 PM posted to microsoft.public.outlook.program_vba
-mhd
external usenet poster
 
Posts: 6
Default 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
 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
change format of phone field from text to phone Jim Outlook - Using Contacts 1 May 19th 06 01:29 AM
Include a field for a business card image in outlook(any size/sid Prieto Chulo Outlook - Using Forms 0 May 13th 06 11:57 PM
how do i format phone number field tnbubba Outlook - General Queries 1 May 1st 06 04:04 PM
LDAP and missing field company name Kathy Outlook - Using Contacts 0 February 1st 06 06:34 AM
Populate Company field from Contact field in custom task form Sue Mosher [MVP-Outlook] Outlook - Using Forms 0 January 20th 06 07:37 PM


All times are GMT +1. The time now is 05:22 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-2025 Outlook Banter.
The comments are property of their posters.