1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
|
Private Sub txtTo_KeyPress(sender As Object, e As EventArgs) Handles txtTo.KeyPress
Dim objOLe As outlook.Application
Dim obNamespace As Namespace
Dim objAddrList As AddressList
Dim objAddrEntries As AddressEntries
Dim objAdrEntry As AddressEntry
Dim i As Integer
' initialisation de la liste
' txtTo.Text = ""
objOLe = CreateObject("Outlook.Application")
obNamespace = objOLe.GetNamespace("MAPI")
objAddrList = obNamespace.AddressLists("Contacts")
objAddrEntries = objAddrList.AddressEntries
objAdrEntry = objAddrEntries.GetFirst
For i = To objAddrEntries.Count
With txtTo.Text
.AddItem objAdrEntry.Name
.AddItem objAdrEntry.Name, 0
.AddItem objAdrEntry.Address, 1
End With
objAdrEntry = objAddrEntries.GetNext
Next i
End Sub |
Partager