Solved

Help!!How du u read the outlook address book

Posted on 2000-05-06
5
139 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 150 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

Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Saving history changes to sub form 4 56
bit defender blocks good applications 2 119
How to Add / Edit Windows Menu 4 80
Sub or Function is not defined 6 59
Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
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…

732 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