Macro VBA pour exporter les contacts Outlook sous Roundcube

‘Ouvrir carnet adresses Outlook
‘selectionner qq adresses

‘Exporte les contacts Outlook selectionnés sous forme de Vcard individuelles


Const mypath As String = « C:\Data\Vcards\ »
Sub save_contacts()
Dim mycontact As Outlook.ContactItem
For Each mycontact In Outlook.ActiveExplorer.Selection
mycontact.SaveAs mypath & mycontact & « .vcf », Type:=olVCard
Next mycontact
End Sub

‘Fusionne toutes les Vcards présentes dans le répertoire en un fichier texte importable sous RoundCube
Sub save_contacts_all()
Dim strOutputDirectory, strOutputFilePrefix, strOutputFileSuffix As String
strTypeCommand = « c:\windows\system32\cmd.exe /c »
strOutputDirectory = mypath

strOutputFileSuffix = « .vcf »
strOutputFileName = « allContacts.txt »

Dim strCommand As String

strCommand = strTypeCommand &  » «  »copy  » & strOutputDirectory & « * » & strOutputFileSuffix &  »  » & strOutputDirectory & strOutputFileName & «  » » »
‘Debug.Print strCommand
Call Shell(strCommand, 3)

End Sub