Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error accessing outlook express address book

Status
Not open for further replies.

1todd1

Programmer
Jan 19, 2002
17
NZ
Ive the following code in which I receive the following error (user defined type not defined on the line Dim olAL As Outlook.AddressList. Yet I have the outlook 8 object library and the Outlook express type library selected in the references section. Has anyone any ideas - would be appreciated

Thanks for your time Todd :)

CODE

Option Explicit

Dim olApp As Outlook.Application
Dim olNS As Outlook.NameSpace
Dim olAL As Outlook.AddressList
Dim olAE As Outlook.AddressEntry
Dim olMail As Outlook.MailItem
-----------------------------------------------
Private Sub Form_Load()
Set olApp = New Outlook.Application
Set olNS = olApp.GetNamespace("MAPI")
For Each olAL In olNS.AddressLists
For Each olAE In olAL.AddressEntries
lvw.ListItems.Add , , olAE.Name
lvw.ListItems(lvw.ListItems.Count).SubItems(1) = olAE.Address
lvw.ListItems(lvw.ListItems.Count).SubItems(2) = olAE.ID
lvw.ListItems(lvw.ListItems.Count).Tag = olAE.ID
Next
Next
End Sub
 
only have outlook 8 here (not express) but have you checked the object browser to see if AddressList and AddressEntry are indeed classes of the Outlook library?

I set a reference to the Microsoft Outlook 8.0 object library and could not find these classes.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top