Help!

Comparing external list of names to contact entries?

 
  

Post new topic   General Reply to Topic (not reply to a specific post)    Forums Home -> Programming VBA RSS
Next:  Outlook 97 Macro to move selected email(s) to oth..  
Author Message
Dan Trimble
External


Since: Mar 26, 2009
Posts: 1



PostPosted: Thu Mar 26, 2009 10:44 am    Post subject: Comparing external list of names to contact entries?
Archived from groups: microsoft>public>outlook>program_vba (more info?)

I have a list of names in an external file. Right now, it's an excel 2003
spreadsheet with separate columns for first name and last name, but I can
just as easily put it into Access, Word, text/CSV, etc. Each name on the
list corresponds to a contact in Outlook -- or it might not (some don't
exist, and don't need to).

I need a script or program that will compare the names *OR* File As fields
of each contact in Outlook with the external list. It does not need to
search any field other the names fields. If it doesn't exist, it can move on
to the next one. But if a contact entry in Outlook DOES exist for that name,
I need it to move the contact to another Outlook contacts folder. Or, at the
very least, flag it or assign it to a category. Then I could always filter
on that flag or category and move all of them at once by hand.

I've been doing this manually, one by one, and I'm tired Smile There's about
3,800 names to get through, and I'm only on 1,219--after several hours of
doing this.

Anyone have any suggestions on how this can be done more efficiently? Is
there a script or program that can do it? I'm very technically inclined
(used to program, but it's been years and am not familiar with Outlook's
object model), and don't mind something fairly complicated, but I desparately
need to find some way to do this more efficiently/automated.

Dan
Back to top
Michael Bauer [MVP - Outl
External


Since: Aug 04, 2006
Posts: 647



PostPosted: Thu Mar 26, 2009 3:10 pm    Post subject: Re: Comparing external list of names to contact entries? [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

You can start with this. Please see the 'set c= ...' line, you need to
complete that yourself. The VBA helpfile explains how to use the Find
function, and there's already an example for searching for the FileAs field.

sub compare()
dim xl as excel.application
dim wb as excel.workbook
dim ws as excel.worksheet
dim rn as excel.range
dim f1 as outlook.mapifolder
dim f2 as outlook.mapifolder
dim items as outlook.items
dim c as outlook.contactitem

set xl=getobject(,"excel.application")
set wb=xl.workbooks(1)
set ws=wb.sheets(1)
set rn=ws.range("a1")

' compare with this contacts
set f1=application.session.pickfolder
set items=f1.items
' move to this
set f2=application.session.pickfolder

while rn.value <> ""
' please complete this yourself...
set c=items.find(...)

if not c is nothing then c.move f2
' move on to the next excel row
set rn=rn.offset(1,0)
wend
end sub

--
Best regards
Michael Bauer - MVP Outlook

: Outlook Categories? Category Manager Is Your Tool
: VBOffice Reporter for Data Analysis & Reporting
: <http://www.vboffice.net/product.html?pub=6&lang=en>


Am Thu, 26 Mar 2009 10:44:17 -0700 schrieb Dan Trimble:

> I have a list of names in an external file. Right now, it's an excel 2003
> spreadsheet with separate columns for first name and last name, but I can
> just as easily put it into Access, Word, text/CSV, etc. Each name on the
> list corresponds to a contact in Outlook -- or it might not (some don't
> exist, and don't need to).
>
> I need a script or program that will compare the names *OR* File As fields
> of each contact in Outlook with the external list. It does not need to
> search any field other the names fields. If it doesn't exist, it can move
on
> to the next one. But if a contact entry in Outlook DOES exist for that
name,
> I need it to move the contact to another Outlook contacts folder. Or, at
the
> very least, flag it or assign it to a category. Then I could always
filter
> on that flag or category and move all of them at once by hand.
>
> I've been doing this manually, one by one, and I'm tired Smile There's about
> 3,800 names to get through, and I'm only on 1,219--after several hours of
> doing this.
>
> Anyone have any suggestions on how this can be done more efficiently? Is
> there a script or program that can do it? I'm very technically inclined
> (used to program, but it's been years and am not familiar with Outlook's
> object model), and don't mind something fairly complicated, but I
desparately
> need to find some way to do this more efficiently/automated.
>
> Dan
Back to top
Display posts from previous:   
Post new topic   General Reply to Topic (not reply to a specific post)    Forums Home -> Programming VBA All times are: Eastern Time (US & Canada) (change)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum