Hi,
Does anyone knows how do I get names and emails from my Outlook Contact List/Address Book and load it into say, a combo box?
I know it's something to do with the Outlook.AddressLists but I can't declare it well.
Thanks for any help!!!
Printable View
Hi,
Does anyone knows how do I get names and emails from my Outlook Contact List/Address Book and load it into say, a combo box?
I know it's something to do with the Outlook.AddressLists but I can't declare it well.
Thanks for any help!!!
Well, using Outlook 2000 I managed to get the members in my contacts list in a listbox like this:
I suppose you could loop through the addresslists the same way I looped through the addressentries, to get the members from all addresslists.Code:Private Sub Command1_Click()
Dim OA As Outlook.Application
Dim NS As Outlook.NameSpace
Dim AL As Outlook.AddressList
Dim AE As Outlook.AddressEntry
Set OA = CreateObject("Outlook.Application")
Set NS = OA.GetNamespace("MAPI")
Set AL = NS.AddressLists("Contacts")
For Each AE In AL.AddressEntries
List1.AddItem AE.Name
Next
Set AE = Nothing
Set AL = Nothing
Set NS = Nothing
Set OA = Nothing
End Sub
Thanks FransC
BTW, is there any website that gives explanation and details on all the Outlook 2000 objects, properties and methods?
I try searching in the online MSDN but there isn't much help there :(
Thanks a lot!!
Update, anyone? Thanks!! :D
A lot of documentation is available in the outlook help for visual basic.
This is from the standard outlook help:
Get Help for Visual Basic for Applications
Open a Microsoft Outlook item.
On the Tools menu, point to Macro, and then click Visual Basic Editor.
On the Help menu, click Microsoft Visual Basic Help.
If you have not previously installed the Visual Basic for Applications support, click Yes to install it.