Solved

What's the best way to Import CSV data to Outlook Contacts weekly?

Posted on 2004-08-23
5
309 Views
Last Modified: 2010-04-08
Hi Experts!

I have a client with a proprietary system for managing their business that also contains all their contact information.  They would like to have this information in a public folder of Outlook contacts also.

The proprietary system has some features that will let me export the data to a CSV file - name, address, phone number, etc.

I would like to automate the process of importing this data to Outlook.  I did a dry run with the Outlook import tool, and it's pretty close.  But I think to truly automate it (and remove office workers from the equation) I will need to use some script or some such.  

I programmed in the (distant...) past, and have read through posts suggesting that this can be done.  In my head, I imagine a solution where I write a VBS script to read the CVS file and use the Outlook model to write it out.  Is this the way to go?  If so, can someone give me a sample script I could modify to match the fields I have?

My CSV today has stuff like this...
First Name      Middle Name      Last Name      Suffix      Company Name      Phone Number      Fax Number      Mobile Phone      Business Street      Business Street 2      Business City      Business State      Business Postal Code      Email Address


Thanks for ideas and help!
0
Comment
Question by:localmagic
  • 2
  • 2
5 Comments
 
LVL 49

Accepted Solution

by:
sunray_2003 earned 500 total points
Comment Utility
Hi localmagic,

May be you are looking for this one

http:Q_20990824.html

All the best

SR..
0
 

Author Comment

by:localmagic
Comment Utility
Thanks SR,

That does look most promising.  Can I use this code as subroutines in a "whatever.vbs" script running under WSH?  I have gotten  a bit confused lately -- some are designed to run as VBA/macro stuff under Outlook.  If that's true, then it looks like a little tweaking and some startup routines and I would be there.

LM
0
 
LVL 49

Expert Comment

by:sunray_2003
Comment Utility
Not familiar with VBA code, Sorry ..

Try to use that code as it is and see if that would first solve your issue and then work on tweaking..

SR
0
 
LVL 18

Expert Comment

by:meintsi
Comment Utility
As far as format required for input, export several contacts from Outlook into a .csv file and look at teh column headings.
0
 

Author Comment

by:localmagic
Comment Utility
Thanks SR,

I finally decided that scripts weren't going to do it, so took a look at the other references and began coding a VB app.  In case it will help anyone else, here's the 'proof of concept' test I wrote.....

Dim strLine As String, strData() As String
Dim colItems As Items
Dim oOutlook As New Outlook.Application
Set colItems = oOutlook.GetNamespace("MAPI"). _
                        GetDefaultFolder(olFolderContacts).Items

'   Open the text file:
    Open "C:\Outlook.csv" For Input As #1

'   Discard the first line since that's the header info
    Line Input #1, stgrLine

'   Grab the data outta the file one line at a time until you hit the EOF mark:
    While Not EOF(1)

        '   Read a line
        Line Input #1, strLine

        '   Split the line into an array containing the data:
        strData = Split(strLine, ",")

        '   Write Contacts to Outlook
            With colItems.Add
                .FirstName = strData(0)
                .MiddleName = strData(1)
                .LastName = strData(2)
                .Save
             End With  

0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Find out how to use dynamic social media in email signatures with this top 10 DOs & DON’Ts.
If you don't know how to downgrade, my instructions below should be helpful.
This Experts Exchange video Micro Tutorial shows how to tell Microsoft Office that a word is NOT spelled correctly. Microsoft Office has a built-in, main dictionary that is shared by Office apps, including Excel, Outlook, PowerPoint, and Word. When …
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now