Vous êtes sur la page 1sur 2

How to Import Multiple vCard Files in MS Outlook

Source of this post


You can import multiple vCard files, the ones with the extension .vcf, in the Microsoft
Office Outlook using a VBA macro !ust follow the steps "elow#
$ Create a folder on the root of the C: drive and name it VCARDS
% Cop& all &our individual vCard files 'vcf( to this newl& created folder
) Open Outlook and click ALT F!! to open the VBA editor
* Click TOOLS ""# R$F$R$%C$S and then select Mi&roso't S&riptin(
Runtime and )indows S&ript Host O*+e&t Model from the list and place
checks in the "ox next to each and click O+
, Click I%S$RT ""# MOD,L$ and cop& and paste the code "elow into the "lank
module and save it
Sub OpenSaveVCard()
Dim objWSHShell As IWshRuntimeLibrar!IWshShell
Dim objOL As Outloo"!Appli#ation
Dim #olInsp As Outloo"!Inspe#tors
Dim strVC$ame As Strin%
Dim &so As S#riptin%!'ileSstemObje#t
Dim &sDir As S#riptin%!'older
Dim &s'ile As S#riptin%!'ile
Dim vCounter As Inte%er
Set &so ( $e) S#riptin%!'ileSstemObje#t
Set &sDir ( &so!*et'older(+C,-VCARDS+)
'or .a#h &s'ile In &sDir!'iles
strVC$ame ( +C,-VCARDS-+ / &s'ile!$ame
Set objOL ( CreateObje#t(+Outloo"!Appli#ation+)
Set #olInsp ( objOL!Inspe#tors
I& #olInsp!Count ( 0 1hen
Set objWSHShell ( CreateObje#t(+WS#ript!Shell+)
objWSHShell!Run Chr(23) / strVC$ame / Chr(23)
Set #olInsp ( objOL!Inspe#tors
I& .rr ( 0 1hen
Do 4ntil #olInsp!Count ( 5
Do.vents
Loop
#olInsp!Item(5)!CurrentItem!Save
#olInsp!Item(5)!Close olDis#ard
Set #olInsp ( $othin%
Set objOL ( $othin%
Set objWSHShell ( $othin%
.nd I&
.nd I&
$e6t
.nd Sub
- .inall&, run the macro to automaticall& import and save all the individual files into
Outlook
But *e'ore runnin( the macro /ust ensure the following#
a 0hether Outlook is the default program to open -.v&' files You can check this "&
right1clicking the file and choosing 2/roperties3 4he /roperties Dialo( 0o1 will
open 5o to the 2eneral Ta* and check whether Opens )it3 has Mi&roso't
O''i&e Outlook written "esides it 6f it3s not so, then click on the C3an(e "utton
and select 2Microsoft Office Outlook3 from the list of programs 6n the
2/roperties Dialo( 0o13 click Appl4 and O5
" Check Macro Securit& Settings in MS Outlook 5o to Tools"#Ma&ro17Se&urit4
Set it to 2%o Se&urit4 C3e&k 'or Ma&ros38 run the macro and after finishing reset
&our previous Macro Setting
c 6For m4 use onl47 Delete all previousl4 saved &onta&ts in Outlook *e'ore
runnin( t3e ma&ro.
And do the following a'ter macro 'inis3es the import#
a Change "ack the default program to open -.v&' files from Outlook to the
previousl& set default program 'in m& case its 9otepad::(
" Change "ack the Macro Securit& settings from 2%o Se&urit4 C3e&k 'or Ma&ros3
to &our previousl& set one 'in m& case ;)arnin( 'or si(ned ma&ros and disa*le
all unsi(ned ma&ros<(
/.S. 6t will take some time to complete the operation 'mine took around ) minutes for -=>
vcf files(, depending upon the no of vCards &ou are importing, as it opens the individual
files and saves it in Outlook
.urther, &ou cannot do an&thing else on &our s&stem in the meanwhile 6t works fine in
Microsoft Office Outlook %>>) and %>>=8 not sure a"out others