Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Help!!How du u read the outlook address book

Posted on 2000-05-06
5
Medium Priority
?
143 Views
Last Modified: 2010-05-02
I would like to know how u can read outlooks address book and input it into a listbox in VB.

Thanks
Jack
0
Comment
Question by:Portal111
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
5 Comments
 
LVL 28

Accepted Solution

by:
AzraSound earned 600 total points
ID: 2784603
0
 

Expert Comment

by:AZWolf7
ID: 2784616
Here is some sample code. Create a new project, and set a reference to CDO 1.21 (or whatever version you have), Create a form with a listbox called list1, and a button called Command1. Here's the code...

Private Sub Command1_Click()

    Dim objSession As Session
    Dim objPAB As AddressList
    Dim objEntries As AddressEntries
    Dim objEntry As AddressEntry
    Dim idx As Integer
   
    Set objSession = New Session
    objSession.Logon ShowDialog:=True
   
    If objSession Is Nothing Then Exit Sub
    Set objPAB = objSession.GetAddressList(0)

    'substitute 1 for the 0 above for the personal address book
    If objPAB Is Nothing Then Exit Sub
    Set objEntries = objPAB.AddressEntries
   
    For idx = 1 To objEntries.Count
        Set objEntry = objEntries.Item(idx)
        List1.AddItem objEntry.Name
    Next idx

End Sub

You'd probably want to close your session and set the objects = nothing when you are done....
0
 

Author Comment

by:Portal111
ID: 2784700
Thanks AzraSound !!
0
 

Author Comment

by:Portal111
ID: 2784708
Thanks guys
0
 

Author Comment

by:Portal111
ID: 2784728
Alright AZWolf7, thanks for the code but when i try it it says "User-defined type not defined" and i don't know what to do, i have tried everything.
Thanks, Jack
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Suggested Courses

604 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question