Twitter iPhone pliant OnePlus 11 PS5 Disney+ Orange Livebox Windows 11

ajouter une adresse dans le carnet d'Outlook Express a partir d'une feuille excel en VBA ?

1 réponse
Avatar
Gadget
Bon ben voilà j'ai tout dit.
Merci d'avance.

1 réponse

Avatar
David
Bonjour,

Je pense que ce code te permettra d'ajouter un contact à Outlook via un code
VBA sous Excel : (Pour outlook express, je ne pense pas que c'est possible
car il ne gere pas l'automation)
Sub AddContactOutlook()
'activate Microsoft Outlook xx.x Object Library
Dim objOutlook As New Outlook.Application
Dim objContact As contactItem


Set objContact = objOutlook.createItem(olContactItem)


With objContact
.email1Address = ""
.FirstName = "firstName"
.lastName = "lastName"
.homeTelephoneNumber = "00 00 00 00 00"
.homeAddressCity = "theCity"
.Save
End With
End Sub


control if a firstName exist in the contacts list


Sub controleFirstName_contactsOutlook()
'activate Microsoft Outlook xx.x Object Library
Dim olApp As New Outlook.Application
Dim Cible As Outlook.contactItem
Dim dossierContacts As Outlook.MAPIFolder


Set olApp = New Outlook.Application
Set dossierContacts olApp.GetNamespace("MAPI").GetDefaultFolder(olFolderContacts)


Set Cible = dossierContacts.Items.Find("[FirstName] = ""firstName""")
If Not Cible Is Nothing Then
MsgBox "Exist"
Else
MsgBox "Does not exist"
End If
End Sub


Bonne journée

David



"Gadget" wrote in message
news:44fc4840$0$27366$
Bon ben voilà j'ai tout dit.
Merci d'avance.