[FAQ] Importer fichier VCF multiple dans les contacts
De nombreuses messageries (en particulier sur les smartphones) exportent tous les contacts dans un seul fichier VCF.
Malheureusement, Outlook ne permet de n'importer qu'un seul contact VCF (à priori, le premier du fichier).
hibou78 a proposé un solution simple et économique via une macro OutLook.
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
| Sub ImportMultipleVcf()
Dim toggle As Boolean
Dim card As ContactItem
Dim app As New Outlook.Application
Dim namespace As Outlook.namespace
Dim temporary_filename As String
toggle = False
temporary_filename = "c:\temp\tmp.vcf"
Set namespace = app.GetNamespace("MAPI")
' Changer ici le nom du fichier vcf multiple issu de Palm Desktop
Open "c:\temp\all.vcf" For Input As #1
Do While Not EOF(1)
Line Input #1, inputdata
If inputdata = "BEGIN:VCARD" Then
toggle = True
Open temporary_filename For Output As #2
End If
If toggle Then Print #2, inputdata
If inputdata = "END:VCARD" Then
Close #2
toggle = False
Set card = namespace.OpenSharedItem(temporary_filename)
card.Save
End If
Loop
Close #1
End Sub |
Tester et approuver sous OutLook 2010.