Microsoft Outlook does not support importing multiple vCards - you need to import them one vcard at a time. While this is tolerable for a few, its frustrating when you a large number to import.
This can also be done using VBA, basically automating the process you'd use to do it manually: open each contact, save in your default Contacts folder then close it. Unless you are Superman, the macro will finish long before you would.
Macro to bulk import vcards
Begin by creating a folder named vcards on root of the c:\ drive. The path will be c:\vcards. Copy all your individual vCard files (.vcf) to this folder. (You can use a different folder but will need to update the macro with the correct folder path.)
Next open Outlook and press ALT + F11 to open the VBA editor.
Go to Tools, References and select Microsoft Scripting Runtime and Windows Script Host Object Model from the list and place checks in the box next to each and click OK.
Click Insert, Module and copy and paste the following code into the blank module. Save and run the macro to automatically import and save all the individual files into Outlook.
Sub OpenSaveVCard() Dim objWSHShell As IWshRuntimeLibrary.IWshShell Dim objOL As Outlook.Application Dim colInsp As Outlook.Inspectors Dim strVCName As String Dim fso As Scripting.FileSystemObject Dim fsDir As Scripting.Folder Dim fsFile As Scripting.File Dim vCounter As Integer Set fso = New Scripting.FileSystemObject Set fsDir = fso.GetFolder("C:\vcards") For Each fsFile In fsDir.Files 'original code 'strVCName = "C:\vcards\" & fsFile.Name 'Zeda's fix for spaces in filenames strVCName = """C:\vcards\" & fsFile.Name & """" Set objOL = CreateObject("Outlook.Application") Set colInsp = objOL.Inspectors If colInsp.Count = 0 Then Set objWSHShell = CreateObject("WScript.Shell") objWSHShell.Run strVCName Set colInsp = objOL.Inspectors If Err = 0 Then Do Until colInsp.Count = 1 DoEvents Loop colInsp.Item(1).CurrentItem.Save colInsp.Item(1).Close olDiscard Set colInsp = Nothing Set objOL = Nothing Set objWSHShell = Nothing End If End If Next End Sub
Import Contacts Saved as MSG Files
The macro above works with vCard files and replicates the action of opening the vCard and clicking Save, which saves it to the Contacts folder. It won''t work with Contacts saved as .msg files, which are saved to Contacts using the Copy to My Contacts command.
By changing Save in colInsp.Item(1).CurrentItem.Save to Copy or Move, we can import Contacts saved as .msg files.
However, in my tests, Copy created duplicates, while Move created just one contact.
At the top of the macro, under the Dim statements, add these two lines. This tells Outlook where you want to it put the contacts.
Dim olFolder As Outlook.Folder
Set olFolder = Session.GetDefaultFolder(olFolderContacts)
Change the line that saves the message to Move:
colInsp.Item(1).CurrentItem.Move olFolder
Now when you run the macro on a folder containing contacts saved as .msg files, it will place a copy in your default Contacts folder.
More Information
How to use Outlook's VBA Editor
The tools listed at Import vCards in Bulk in Microsoft Outlook will import or export vcards in bulk.
Hi and thx for your code.
I am looking for going the other way, i.e. transfer contacts from Outlook to Thunderbird. Outlook exported all contacts in msg-format, that I would need to convert to vcf-format, and then import to Thunderbird.
Is there some VBA-code I could use from within Excel to realise this?
You saved my life!
actually I prefer thunderbird which is free and handles contacts better and so on. But I have a 70-year-old client who doesn't get used to new programs other than commercial ones. Osea perspective.
almost 600 contacts imported into Outlook 365 with your script. Hugely grateful
PS: Thundebird if it pulls multiple contacts from a vcf file
Basil
from Peru
Hello!
Thanks for the tutorial!
You have a script to import EML files to outlook???, i have a lot of then...
Not offhand, but will look at writing one.
It should be easy to do now that I think about it - open the file, copy to folder.
In looking at this macro and the one at https://www.slipstick.com/developer/code-samples/move-messages-file-system-outlook/ - they should work. I don't have any eml's handy right now to test it... will try to test it later.
Thanks a lot for this! I used it to import 1900 vcards to Outlook so this really helped a lot.
Super great script. I'm a super PC user since 1985. Never programmed beyond AutoCAD's AutoLISP or Basic. This was cinch. Your step by step instructions were perfect. THANK YOU for saving me hours importing 229 VCF files into Outlook 2016.
I get an execution error '440' impossible to move the elements (traduction from french) with the line : colInsp.Item(1).CurrentItem.Move olFolder.
The contact is added but duplicated and the macro stops.
Thanks
what are you using for
Set olFolder = Session.GetDefaultFolder(olFolderContacts) ? (This is the default contacts folder and isn't necessary unless you are using a different folder)
That was PERFECT!! I am not VBA literat at al, but thanks to this code all my contacts from 200 vcf cards are propelly imported with just few clicks!!!
This is GREAT and useful.
Here's what I did:
1) I used gmail to compile & edit a mix of my outlook and android contacts (phone numbers, email and postal addresses, notes, etc.)
2) I exported to my pc the entire list in a single vcard file, to be uploaded to my pc and android device;
3) it worked with android, but outlook was only able to load the first of the many contacts embedded in the single file;
4) I found on the internet and used this portable and free GUI utility to split the single multi-contact vcard file into many single-contact vcard files: VCARD SPLITTER (available at https://vcardsplitter.codeplex.com)
5) I followed the procedure described in this page to load hundreds of vcard files. It worked flawlessly and imported all contacts in seconds.
THANKS!!