Urgent: Lire info de contact outlook depuis vba

cs_nbenoist Messages postés 10 Date d'inscription lundi 17 janvier 2005 Statut Membre Dernière intervention 8 février 2005 - 17 janv. 2005 à 10:03
cs_nbenoist Messages postés 10 Date d'inscription lundi 17 janvier 2005 Statut Membre Dernière intervention 8 février 2005 - 18 janv. 2005 à 14:16
Bonjour
Depuis une fiche contact outlook, je voudrais avoir une fenetre qui s'ouvre avec comme information les n° de telephone du contact dans un combobox.
Mon but est de pouvoir afficher un numéro modifier du numéro de contact dans une liste box

ex : je séléctionne dans la combobox +1 123 123 1234
et il s'affiche 00011231231234

3 réponses

michelxld Messages postés 402 Date d'inscription vendredi 6 août 2004 Statut Membre Dernière intervention 12 octobre 2008 32
17 janv. 2005 à 19:44
bonsoir

j'espere que cet exemple pourra t'aider

Option Compare Text
Sub numeroTelephone_contactsOutlook()
'necessite d'activer la reference Microsoft Outlook xx.x Object Library
Dim olApp As New Outlook.Application
Dim Cible As Outlook.ContactItem
Dim dossierContacts As Outlook.MAPIFolder
Dim Resultat As String


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


For Each Cible In dossierContacts.Items
If Cible.LastName = "MichelXld" Then
MsgBox Cible.HomeTelephoneNumber
Exit For
End If
Next


End Sub

bonne soiree
michel
0
cs_nbenoist Messages postés 10 Date d'inscription lundi 17 janvier 2005 Statut Membre Dernière intervention 8 février 2005
18 janv. 2005 à 14:13
Je te remercie lichel pour ton code mais tu est obliger de conaitre le nom du contact
Alors que moi je ne le connais pas, il dépent depuis quel fiche contact j'ai executer la macro.
j'ai réussi à trouver le code ci-dessous qui fonctionne

Sub numerocontact()

Dim ol As Outlook.Application
Dim myInspector As Outlook.Inspector
Dim strContactInfo As String

Set ol = New Outlook.Application
Set myInspector = ol.ActiveInspector

On Error Resume Next
strContactInfo = myInspector.CurrentItem.FullName
If Err.Number <> 0 Then
MsgBox "Un contact d'outlook doit etre ouvert...", , mtitle

Err.Clear ' Clear Err object fields
On Error GoTo 0
Set ol = Nothing
Exit Sub
End If
MsgBox myInspector.CurrentItem.BusinessTelephoneNumber
End Sub
0
cs_nbenoist Messages postés 10 Date d'inscription lundi 17 janvier 2005 Statut Membre Dernière intervention 8 février 2005
18 janv. 2005 à 14:16
desole pour l'affichage
Je ne comprend pas pourquoi cela donne ca

Bizard
0
Rejoignez-nous