OVH Cloud OVH Cloud

Carnet d'adresses outlook et Excel

1 réponse
Avatar
Jean-Marc
Bonjour,
Est-il possible avec une macro d'importer un contact Outlook dans une
cellule Excel ?
Merci
Jean-Marc

1 réponse

Avatar
Nicolas B.
Salut Jean-Marc,

Essaye cette macro qui importe trois propriétés possibles d'un contact :

Sub ImporterContact()
Dim ol As Outlook.Application
Dim Contact As Outlook.ContactItem

Set ol = CreateObject("Outlook.Application")
Set Contact = ol.GetNamespace("MAPI").GetDefaultFolder _
(olFolderContacts).Items.Find("[FileAs] = ""Dupont, Jean""")
If Not TypeName(Contact) = "Nothing" Then
With Contact
Cells(1, 1) = .FullName
Cells(2, 1) = .CompanyName
Cells(3, 1) = .Email1Address
End With
Else
MsgBox "Le contact n'existe pas."
End If
End Sub

Il faut cocher Microsoft Outlook X Object Library dans les références VBA.


A+
--
Nicolas B.


Bonjour,
Est-il possible avec une macro d'importer un contact Outlook dans une
cellule Excel ?
Merci
Jean-Marc