?
Solved

Help!!How du u read the outlook address book

Posted on 2000-05-06
5
Medium Priority
?
141 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses
Course of the Month8 days, 22 hours left to enroll

764 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