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
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