ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   populating list box with contacts (https://www.excelbanter.com/excel-programming/328757-populating-list-box-contacts.html)

GeorgeFD29

populating list box with contacts
 
I am trying to populate a list box in excel with the FirstName object of my
outlook2000 contacts; then when the user selects a FirstName, I retrieve
items like email address for the contact they selected and store to a cell in
the sheet.

I feel like Edison working on the light bulb. Any help would be greatly
appriciated.

Thanks,
George

GeorgeFD29

populating list box with contacts
 


"GeorgeFD29" wrote:

I am trying to populate a list box in excel with the FirstName object of my
outlook2000 contacts; then when the user selects a FirstName, I retrieve
items like email address for the contact they selected and store to a cell in
the sheet.

I feel like Edison working on the light bulb. Any help would be greatly
appriciated.

Thanks,
George


I have the following code working - talking to outlook. However, whenever I
try to return the email address of the contact, I get 'object doesn't support
this property or method' thanks for any help.

Dim OLF As Outlook.MAPIFolder
Dim olContactItem As Outlook.ContactItem
Dim ToContact As Recipient
Set OLF = GetObject("",
"Outlook.Application").GetNamespace("MAPI").GetDef aultFolder(olFolderContacts)

Set itms = OLF.Items

If itms.Count = 0 Then
MsgBox "No contacts to add to drop-down list"
Exit Sub
End If


For i = 1 To itms.Count
Set itm = itms(i)
strContactName = itm.LastName & ", " & itm.FirstName & " " & itm.MiddleName
strEmail = itm.email
Next


All times are GMT +1. The time now is 07:25 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com