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

How to compare 2 contacts with VBA?



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old December 18th 07, 04:32 PM posted to microsoft.public.outlook.program_vba
Chris S[_2_]
external usenet poster
 
Posts: 6
Default How to compare 2 contacts with VBA?

Hi,

I have written a macro that lists all duplicates in an outlook
contacts folder. Now that I know which contacts are duplicated, I am
trying to find out WHAT differences, if any, there are between the
duplicates.

So, does anyone know how to find/list all the non empty fields in any
given contact using vba?

Thanks.
  #2  
Old December 18th 07, 04:52 PM posted to microsoft.public.outlook.program_vba
Sue Mosher [MVP-Outlook]
external usenet poster
 
Posts: 11,651
Default How to compare 2 contacts with VBA?

You can use the ItemProperties collection to iterate all the standard fields except for collection like Links.

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


"Chris S" wrote in message ...
Hi,

I have written a macro that lists all duplicates in an outlook
contacts folder. Now that I know which contacts are duplicated, I am
trying to find out WHAT differences, if any, there are between the
duplicates.

So, does anyone know how to find/list all the non empty fields in any
given contact using vba?

Thanks.

  #3  
Old December 18th 07, 05:48 PM posted to microsoft.public.outlook.program_vba
Chris S[_2_]
external usenet poster
 
Posts: 6
Default How to compare 2 contacts with VBA?

On Dec 18, 3:52 pm, "Sue Mosher [MVP-Outlook]"
wrote:
You can use the ItemProperties collection to iterate all the standard fields except for collection like Links.

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

"Chris S" wrote in ...
Hi,


I have written a macro that lists all duplicates in an outlook
contacts folder. Now that I know which contacts are duplicated, I am
trying to find out WHAT differences, if any, there are between the
duplicates.


So, does anyone know how to find/list all the non empty fields in any
given contact using vba?


Thanks.


Thanks Sue. I am currently trying that route, but so far not
successfully! this is what I have:


For Each ItemProperty In olColItems(i).ItemProperties
If ItemProperty Is Empty Then propCount = propCount + 1
Next

But I get an object required error on the If statement... I am not
sure i am using it properly, do you have any ideas what I am doing
wrong? i am trying to get proCount to be populated with the number of
fields that are NOT empty in any given contact.



  #4  
Old December 18th 07, 06:01 PM posted to microsoft.public.outlook.program_vba
Sue Mosher [MVP-Outlook]
external usenet poster
 
Posts: 11,651
Default How to compare 2 contacts with VBA?

How is olColItems instantiated?

I'm not sure that Empty is going to work, as standard properties generally do have values. Try looking at ItemProperty.Type and then test for "", 0, and #1/1/4501#, depending on whether the property is text, numeric, or date/time. You should ignore any properties where Type = olOutlookInternal, olFormula, or olCombination.
--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54


"Chris S" wrote in message ...

I have written a macro that lists all duplicates in an outlook
contacts folder. Now that I know which contacts are duplicated, I am
trying to find out WHAT differences, if any, there are between the
duplicates.


this is what I have:

For Each ItemProperty In olColItems(i).ItemProperties
If ItemProperty Is Empty Then propCount = propCount + 1
Next

But I get an object required error on the If statement... I am not
sure i am using it properly, do you have any ideas what I am doing
wrong? i am trying to get proCount to be populated with the number of
fields that are NOT empty in any given contact.


  #5  
Old December 18th 07, 06:24 PM posted to microsoft.public.outlook.program_vba
Chris S[_2_]
external usenet poster
 
Posts: 6
Default How to compare 2 contacts with VBA?

On Dec 18, 5:01 pm, "Sue Mosher [MVP-Outlook]"
wrote:
How is olColItems instantiated?

I'm not sure that Empty is going to work, as standard properties generally do have values. Try looking at ItemProperty.Type and then test for "", 0, and #1/1/4501#, depending on whether the property is text, numeric, or date/time. You should ignore any properties where Type = olOutlookInternal, olFormula, or olCombination.
--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54

"Chris S" wrote in ...

I have written a macro that lists all duplicates in an outlook
contacts folder. Now that I know which contacts are duplicated, I am
trying to find out WHAT differences, if any, there are between the
duplicates.


this is what I have:


For Each ItemProperty In olColItems(i).ItemProperties
If ItemProperty Is Empty Then propCount = propCount + 1
Next


But I get an object required error on the If statement... I am not
sure i am using it properly, do you have any ideas what I am doing
wrong? i am trying to get proCount to be populated with the number of
fields that are NOT empty in any given contact.


olcolitems is DIM'ed as outlook.items a an SET to contain individual
contact items from the default contact folder (i am also DIM'ming/
SET'ing an outlook.application, an outlook.namespace and an
outlook.mapifolder), and seems to work well in the context of my
duplicate finding macro.

i dont, however, understand what you mean by testing for property
type, as i am looking to count/list non empty fields.

  #6  
Old December 18th 07, 06:36 PM posted to microsoft.public.outlook.program_vba
Sue Mosher [MVP-Outlook]
external usenet poster
 
Posts: 11,651
Default How to compare 2 contacts with VBA?

The problem is that "non empty" is meaningless in your scenario, because standard properties generally are not null or empty. They have values. If you want to know whether a property is "blank," you need to test for the value appropriate to that type of property. For example, you might consider a "blank" text property to be one with a value of "". A "blank" date/time property would have a value of #1/1/4501#.

Please show the code you're using to instantiate olColItems.
--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54


"Chris S" wrote in message ...
On Dec 18, 5:01 pm, "Sue Mosher [MVP-Outlook]"
wrote:
How is olColItems instantiated?

I'm not sure that Empty is going to work, as standard properties generally do have values. Try looking at ItemProperty.Type and then test for "", 0, and #1/1/4501#, depending on whether the property is text, numeric, or date/time. You should ignore any properties where Type = olOutlookInternal, olFormula, or olCombination.


"Chris S" wrote in ...

I have written a macro that lists all duplicates in an outlook
contacts folder. Now that I know which contacts are duplicated, I am
trying to find out WHAT differences, if any, there are between the
duplicates.


this is what I have:


For Each ItemProperty In olColItems(i).ItemProperties
If ItemProperty Is Empty Then propCount = propCount + 1
Next


But I get an object required error on the If statement... I am not
sure i am using it properly, do you have any ideas what I am doing
wrong? i am trying to get proCount to be populated with the number of
fields that are NOT empty in any given contact.


olcolitems is DIM'ed as outlook.items a an SET to contain individual
contact items from the default contact folder (i am also DIM'ming/
SET'ing an outlook.application, an outlook.namespace and an
outlook.mapifolder), and seems to work well in the context of my
duplicate finding macro.

i dont, however, understand what you mean by testing for property
type, as i am looking to count/list non empty fields.

 




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
Read email and compare text Satish Outlook - General Queries 0 December 28th 06 03:26 PM
How can I compare two contact files to highlight differences? Mark Outlook - Using Contacts 1 October 4th 06 09:39 PM
how can I compare two contact lists in order to avoid repetition Pabs Outlook - Using Contacts 2 September 27th 06 05:18 PM
How do I compare two contact files Jaron Outlook - Using Contacts 1 August 30th 06 02:50 PM
compare multiple contact lists Tish Outlook - Using Contacts 1 April 29th 06 04:07 PM


All times are GMT +1. The time now is 12:54 PM.


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.