Selasa, 06 Maret 2012

Re: [ExcelVBA] Re: searchin outlook address book

 

I agree with Michael - a binary search algorithm will be much more efficient. You should find the entry you're looking for in, at most, 16 tries.
However, I'm dumbfounded that Outlook.AddressEntries doesn't already have a "built-in" function for performing a binary search.

----- Original Message -----
From: David Braithwaite
To: ExcelVBA@yahoogroups.com
Sent: Tuesday, March 06, 2012 11:09 AM
Subject: [ExcelVBA] Re: searchin outlook address book

Hi Michael

Right now you are, on average, looking through 50% (25000) names each time
you do a lookup.

For each probe into the address list, you are making a networked access into
this list.

I don't have the resources to test this (no access to a "global address
list"), but

You might try

Dim objAddressListEntries As Outlook.AddressEntries

Set objAddressListEntries = objAddressList.AddressEntries

objAddressListEntries.Sort "ID"

then use a binary search algorithm. This would cut your average searches
per item from 25,000 to less than 20.

Db

[Non-text portions of this message have been removed]

[Non-text portions of this message have been removed]

__._,_.___
Recent Activity:
----------------------------------
Be sure to check out TechTrax Ezine for many, free Excel VBA articles! Go here: http://www.mousetrax.com/techtrax to enter the ezine, then search the ARCHIVES for EXCEL VBA.

----------------------------------
Visit our ExcelVBA group home page for more info and support files:
http://groups.yahoo.com/group/ExcelVBA

----------------------------------
More free tutorials and resources available at:
http://www.mousetrax.com

----------------------------------
.

__,_._,___

Tidak ada komentar:

Posting Komentar