Solved

Import large amount of vCards into outlook

Posted on 2006-10-24
7
1,206 Views
Last Modified: 2012-06-21
Hi Guys
I have about 900 vCards in a zip file. I can import them one-by-one but it will take ages to do. Does any of you know of a method which can import them all at once?

Thanks in advance
Christian Thomasberg
0
Comment
Question by:Scanbox
  • 4
  • 3
7 Comments
 
LVL 76

Accepted Solution

by:
David Lee earned 125 total points
ID: 17794428
Greetings, Christian.

The VBA script (i.e. Outlook macro) below will handle the import of all your vCard files.  Follow these instructions to use it.
1.  Start Outlook.
2.  Click Tools->Macro->Visual Basic Editor.
3.  If not already expanded, expand Modules and click on Module1.
4.  Copy the code below and paste it into the right-hand pane of the VB Editor.
5.  Edit the code as needed.  I placed comment lines where things need to change.
6.  Click the diskette icon on the toolbar to save the changes.
7.  Close the VB Editor.
8.  Click Tools->Macro->Security.
9.  Change the Security Level setting to Medium.
10.  Unzip 100 or so of your vCards into the folder you specified in code.
11.  Run the macro.  It should open each .vcf file onscreen, showing it as an Outlook contact.  Once it's opened all 100 of the .vcf files it will close and save them all.  You can try unzipping all 900 files at once if you want, but that might be too many windows for Outlook to handle.  I'd do 100 at a time.  I know you asked for a solution that would do them all at once, but this is better than doing them manually.  

Sub MassVCFImport()
    'Change the path on the following line to that of the folder holding your .vcf files.  The path must end with a \
    Const ROOT_PATH = "C:\eeTesting\"
    Dim objShell As Object, _
        strFilename As String, _
        intIndex As Integer, _
        objInspector As Outlook.Inspector
    Set objShell = CreateObject("Wscript.Shell")
    strFilename = Dir(ROOT_PATH & "*.vcf")
    Do While strFilename <> ""
        strFilename = ROOT_PATH & strFilename
        objShell.Run strFilename, 1, False
        strFilename = Dir()
    Loop
    For intIndex = Application.Inspectors.Count To 1 Step -1
        Set objInspector = Application.Inspectors.Item(intIndex)
        If objInspector.CurrentItem.Class = olContact Then
            objInspector.Close olSave
        End If
    Next
    Set objShell = Nothing
    Set objInspector = Nothing
End Sub

Cheers!
0
 

Author Comment

by:Scanbox
ID: 17795834
Hi there
Thanks for the fast answer :)
I get this error when I try to run the macro from Outlook:
->        objShell.Run strFilename, 1, False
Run-time error '-2147024894 (80070002)
Method 'Run' of object 'IWshShell3' failed

Do you have any suggestions, how to solve this problem?

Kind regards
Christian
0
 
LVL 76

Expert Comment

by:David Lee
ID: 17800087
Do the individual vCard files end with a .vcf extension?  If yes, please check and see if .vcf is associated with Outlook.
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

Author Comment

by:Scanbox
ID: 17810574
hi again
I have checked that the above conditions is true, but I still get the error when trying to run the macro.
I am trying to import the vcards from citrix, so the folder path would be: M:\vcards - Do you think citrix is causing the problem?

Thanks for taking the tome to help me out, I really appreciate it

/Christian
0
 
LVL 76

Expert Comment

by:David Lee
ID: 17810633
> Do you think citrix is causing the problem?
It's possible.  Is there any way yo can try this outside of Citrix?  I wrote and tested this using Outlook 2003 running on Windows XP and it worked perfectly.
0
 

Author Comment

by:Scanbox
ID: 17818268
It worked :)
Thanks for your help
0
 
LVL 76

Expert Comment

by:David Lee
ID: 17819532
Cool.  You're welcome.
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Follow this checklist to learn more about the 15 things you should never include in an email signature from personal quotes, animated gifs and out-of-date marketing content.
If you don't know how to downgrade, my instructions below should be helpful.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…

744 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

13 Experts available now in Live!

Get 1:1 Help Now