OVH Cloud OVH Cloud

Contacts

6 réponses
Avatar
Robert Parise
Je veux mettre les contacts trouvé dans une liste. Je bloc sur la partie
For Each objEBRContact...

Merci

Voici mon code.

Private Sub txtFindPublicContact_AfterUpdate()

Dim objOutlook As Outlook.Application
Dim objNameSpace As Outlook.NameSpace
Dim LeDossEBRContacts As Outlook.MAPIFolder
Dim objEBRContacts As Outlook.Items
Dim objEBRContact As ContactItem
Dim objEBRContactunit As ContactItem
Dim strItem As String

'Get a reference to the Items collection of the contacts folder.
Set objOutlook = New Outlook.Application
Set objNameSpace = objOutlook.GetNamespace("MAPI")
Set LeDossEBRContacts =
objNameSpace.GetDefaultFolder(olPublicFoldersAllPublicFolders).Folders("Public
Contacts")

Set objEBRContacts = LeDossEBRContacts.Items


Set objEBRContact = objEBRContacts.Find("[LastName] = """ &
Me!txtFindPublicContact & """")


For Each objEBRContact ' * * * Manque quelque chose ???
strItem = objEBRContact.LastName & ";" & objEBRContact.LastName & ";" &
objEBRContact.CompanyName
lstPublicContact.AddItem Item:=strItem
Next

'Me.lstPublicContact.Requery

Set objOutlook = Nothing

End Sub

6 réponses

Avatar
Isabelle Prawitz
Bonjour !
Je corrige une erreur plus bas, et rajoute ce qui manque !

"Robert Parise" a écrit dans le message de news:aosNd.14088$
Je veux mettre les contacts trouvé dans une liste. Je bloc sur la partie
For Each objEBRContact...

Merci

Voici mon code.

Private Sub txtFindPublicContact_AfterUpdate()

Dim objOutlook As Outlook.Application
Dim objNameSpace As Outlook.NameSpace
Dim LeDossEBRContacts As Outlook.MAPIFolder
Dim objEBRContacts As Outlook.Items
Dim objEBRContact As ContactItem
Dim objEBRContactunit As ContactItem
Dim strItem As String

'Get a reference to the Items collection of the contacts folder.
Set objOutlook = New Outlook.Application
Set objNameSpace = objOutlook.GetNamespace("MAPI")
Set LeDossEBRContacts > objNameSpace.GetDefaultFolder(olPublicFoldersAllPublicFolders).Folders("Public
Contacts")

Set objEBRContacts = LeDossEBRContacts.Items



' Il manque un s en dessous, car il vaut mieux utiliser un Restrict plutôt qu'un Find pour travailler avec un For Each

Set objEBRContacts = objEBRContacts.Restrict("[LastName] = '" &
Me!txtFindPublicContact & "'")
' un tuyau : pour encadrer une chaîne, utilise '



For Each objEBRContact In objEBRContacts ' * * * Manque quelque chose ??? Voilà !

strItem = objEBRContact.LastName & ";" & objEBRContact.LastName & ";" &
objEBRContact.CompanyName
lstPublicContact.AddItem Item:=strItem
Next

'Me.lstPublicContact.Requery

Set objOutlook = Nothing

End Sub




A+
Isa

Avatar
Robert Parise
Ca fonctionne...
Il ne reste à trouver une solution pour mes numéro de fax...

Merci Mme Prawitz :-) :-) :-)

Robert


"Isabelle Prawitz" a écrit dans le message de news:

Bonjour !
Je corrige une erreur plus bas, et rajoute ce qui manque !

"Robert Parise" a écrit dans le message de
news:aosNd.14088$
Je veux mettre les contacts trouvé dans une liste. Je bloc sur la partie
For Each objEBRContact...

Merci

Voici mon code.

Private Sub txtFindPublicContact_AfterUpdate()

Dim objOutlook As Outlook.Application
Dim objNameSpace As Outlook.NameSpace
Dim LeDossEBRContacts As Outlook.MAPIFolder
Dim objEBRContacts As Outlook.Items
Dim objEBRContact As ContactItem
Dim objEBRContactunit As ContactItem
Dim strItem As String

'Get a reference to the Items collection of the contacts folder.
Set objOutlook = New Outlook.Application
Set objNameSpace = objOutlook.GetNamespace("MAPI")
Set LeDossEBRContacts >> objNameSpace.GetDefaultFolder(olPublicFoldersAllPublicFolders).Folders("Public
Contacts")

Set objEBRContacts = LeDossEBRContacts.Items



' Il manque un s en dessous, car il vaut mieux utiliser un Restrict
plutôt qu'un Find pour travailler avec un For Each

Set objEBRContacts = objEBRContacts.Restrict("[LastName] = '" &
Me!txtFindPublicContact & "'")
' un tuyau : pour encadrer une chaîne, utilise '



For Each objEBRContact In objEBRContacts ' * * * Manque quelque chose

??? Voilà !
strItem = objEBRContact.LastName & ";" & objEBRContact.LastName & ";"
&
objEBRContact.CompanyName
lstPublicContact.AddItem Item:=strItem
Next

'Me.lstPublicContact.Requery

Set objOutlook = Nothing

End Sub




A+
Isa





Avatar
Robert Parise
Est-ce qu'il est possible se faire une recherche sur prusieurs champs. Si
oui, que faut-il ajouter au code...

Merci

"Isabelle Prawitz" a écrit dans le message de news:

Bonjour !
Je corrige une erreur plus bas, et rajoute ce qui manque !

"Robert Parise" a écrit dans le message de
news:aosNd.14088$
Je veux mettre les contacts trouvé dans une liste. Je bloc sur la partie
For Each objEBRContact...

Merci

Voici mon code.

Private Sub txtFindPublicContact_AfterUpdate()

Dim objOutlook As Outlook.Application
Dim objNameSpace As Outlook.NameSpace
Dim LeDossEBRContacts As Outlook.MAPIFolder
Dim objEBRContacts As Outlook.Items
Dim objEBRContact As ContactItem
Dim objEBRContactunit As ContactItem
Dim strItem As String

'Get a reference to the Items collection of the contacts folder.
Set objOutlook = New Outlook.Application
Set objNameSpace = objOutlook.GetNamespace("MAPI")
Set LeDossEBRContacts >> objNameSpace.GetDefaultFolder(olPublicFoldersAllPublicFolders).Folders("Public
Contacts")

Set objEBRContacts = LeDossEBRContacts.Items



' Il manque un s en dessous, car il vaut mieux utiliser un Restrict
plutôt qu'un Find pour travailler avec un For Each

Set objEBRContacts = objEBRContacts.Restrict("[LastName] = '" &
Me!txtFindPublicContact & "'")
' un tuyau : pour encadrer une chaîne, utilise '



For Each objEBRContact In objEBRContacts ' * * * Manque quelque chose

??? Voilà !
strItem = objEBRContact.LastName & ";" & objEBRContact.LastName & ";"
&
objEBRContact.CompanyName
lstPublicContact.AddItem Item:=strItem
Next

'Me.lstPublicContact.Requery

Set objOutlook = Nothing

End Sub




A+
Isa





Avatar
Isabelle Prawitz
Bonjour !
Pour les N° de fax, je t'ai répondu sur le fil plus haut (mon problème de messagerie Wanadoo a dû empêcher la réception en
direct !)
A+
Isa

"Robert Parise" a écrit dans le message de news:xrUOd.18801$
Ca fonctionne...
Il ne reste à trouver une solution pour mes numéro de fax...

Merci Mme Prawitz :-) :-) :-)

Robert


"Isabelle Prawitz" a écrit dans le message de news:

Bonjour !
Je corrige une erreur plus bas, et rajoute ce qui manque !

"Robert Parise" a écrit dans le message de
news:aosNd.14088$
Je veux mettre les contacts trouvé dans une liste. Je bloc sur la partie
For Each objEBRContact...

Merci

Voici mon code.

Private Sub txtFindPublicContact_AfterUpdate()

Dim objOutlook As Outlook.Application
Dim objNameSpace As Outlook.NameSpace
Dim LeDossEBRContacts As Outlook.MAPIFolder
Dim objEBRContacts As Outlook.Items
Dim objEBRContact As ContactItem
Dim objEBRContactunit As ContactItem
Dim strItem As String

'Get a reference to the Items collection of the contacts folder.
Set objOutlook = New Outlook.Application
Set objNameSpace = objOutlook.GetNamespace("MAPI")
Set LeDossEBRContacts > >> objNameSpace.GetDefaultFolder(olPublicFoldersAllPublicFolders).Folders("Public
Contacts")

Set objEBRContacts = LeDossEBRContacts.Items



' Il manque un s en dessous, car il vaut mieux utiliser un Restrict
plutôt qu'un Find pour travailler avec un For Each

Set objEBRContacts = objEBRContacts.Restrict("[LastName] = '" &
Me!txtFindPublicContact & "'")
' un tuyau : pour encadrer une chaîne, utilise '



For Each objEBRContact In objEBRContacts ' * * * Manque quelque chose

??? Voilà !
strItem = objEBRContact.LastName & ";" & objEBRContact.LastName & ";"
&
objEBRContact.CompanyName
lstPublicContact.AddItem Item:=strItem
Next

'Me.lstPublicContact.Requery

Set objOutlook = Nothing

End Sub




A+
Isa









Avatar
Robert Parise
Autre question:
Si je veux faire la recheche sur plusieur champs, comment m'y prendre
1- modifier ce code (besoin d'aide)
2- faire plusieurs objEBRContacts1, objEBRContacts2, objEBRContacts3....et
assemblé les résultats dans strItem. Ce n'est pas très élégant...

Merci

Robert




"Isabelle Prawitz" a écrit dans le message de news:

Bonjour !
Je corrige une erreur plus bas, et rajoute ce qui manque !

"Robert Parise" a écrit dans le message de
news:aosNd.14088$
Je veux mettre les contacts trouvé dans une liste. Je bloc sur la partie
For Each objEBRContact...

Merci

Voici mon code.

Private Sub txtFindPublicContact_AfterUpdate()

Dim objOutlook As Outlook.Application
Dim objNameSpace As Outlook.NameSpace
Dim LeDossEBRContacts As Outlook.MAPIFolder
Dim objEBRContacts As Outlook.Items
Dim objEBRContact As ContactItem
Dim objEBRContactunit As ContactItem
Dim strItem As String

'Get a reference to the Items collection of the contacts folder.
Set objOutlook = New Outlook.Application
Set objNameSpace = objOutlook.GetNamespace("MAPI")
Set LeDossEBRContacts >> objNameSpace.GetDefaultFolder(olPublicFoldersAllPublicFolders).Folders("Public
Contacts")

Set objEBRContacts = LeDossEBRContacts.Items



' Il manque un s en dessous, car il vaut mieux utiliser un Restrict
plutôt qu'un Find pour travailler avec un For Each

Set objEBRContacts = objEBRContacts.Restrict("[LastName] = '" &
Me!txtFindPublicContact & "'")
' un tuyau : pour encadrer une chaîne, utilise '



For Each objEBRContact In objEBRContacts ' * * * Manque quelque chose

??? Voilà !
strItem = objEBRContact.LastName & ";" & objEBRContact.LastName & ";"
&
objEBRContact.CompanyName
lstPublicContact.AddItem Item:=strItem
Next

'Me.lstPublicContact.Requery

Set objOutlook = Nothing

End Sub




A+
Isa





Avatar
Isabelle Prawitz
Oui, il suffit de rajouter " and " ou " or " entre les conditions.
Ex:
Restrict("[LastName]='" & strNom & "' and [CompanyName]='" & strSociété & "'")

A+
Isa

"Robert Parise" a écrit dans le message de news:M6VOd.18805$
Est-ce qu'il est possible se faire une recherche sur prusieurs champs. Si
oui, que faut-il ajouter au code...

Merci

"Isabelle Prawitz" a écrit dans le message de news:

Bonjour !
Je corrige une erreur plus bas, et rajoute ce qui manque !

"Robert Parise" a écrit dans le message de
news:aosNd.14088$
Je veux mettre les contacts trouvé dans une liste. Je bloc sur la partie
For Each objEBRContact...

Merci

Voici mon code.

Private Sub txtFindPublicContact_AfterUpdate()

Dim objOutlook As Outlook.Application
Dim objNameSpace As Outlook.NameSpace
Dim LeDossEBRContacts As Outlook.MAPIFolder
Dim objEBRContacts As Outlook.Items
Dim objEBRContact As ContactItem
Dim objEBRContactunit As ContactItem
Dim strItem As String

'Get a reference to the Items collection of the contacts folder.
Set objOutlook = New Outlook.Application
Set objNameSpace = objOutlook.GetNamespace("MAPI")
Set LeDossEBRContacts > >> objNameSpace.GetDefaultFolder(olPublicFoldersAllPublicFolders).Folders("Public
Contacts")

Set objEBRContacts = LeDossEBRContacts.Items



' Il manque un s en dessous, car il vaut mieux utiliser un Restrict
plutôt qu'un Find pour travailler avec un For Each

Set objEBRContacts = objEBRContacts.Restrict("[LastName] = '" &
Me!txtFindPublicContact & "'")
' un tuyau : pour encadrer une chaîne, utilise '



For Each objEBRContact In objEBRContacts ' * * * Manque quelque chose

??? Voilà !
strItem = objEBRContact.LastName & ";" & objEBRContact.LastName & ";"
&
objEBRContact.CompanyName
lstPublicContact.AddItem Item:=strItem
Next

'Me.lstPublicContact.Requery

Set objOutlook = Nothing

End Sub




A+
Isa