Cette action est irreversible, confirmez la suppression du commentaire ?
Signaler le commentaire
Veuillez sélectionner un problème
Nudité
Violence
Harcèlement
Fraude
Vente illégale
Discours haineux
Terrorisme
Autre
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.
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 = "t...@mail.com"
.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" <Dequoijmemele@pouet.fr> wrote in message
news:44fc4840$0$27366$ba4acef3@news.orange.fr...
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