dhancy
Board Regular
- Joined
- Jul 10, 2013
- Messages
- 123
- Office Version
- 365
- Platform
- Windows
Hello,
As I continue my studies into how to navigate the Outlook hierarchy using Excel VBA, I find that I often run into Run-time error '287':
Please forgive me for asking another question on this subject.
First, my understanding of the Outlook hierarchy is this:
Outlook Application
- Namespace
--- Address Lists
----- Address List
------- Address Entries
--------- Address Entry
If this is not correct, let me know as this might be the source of all my 287 errors.
Here is a snippet of my code:
The 287 error comes on the "Set olEntries" line.
I have Windows 10 and Office 2016.
Tools/References include:
- Visual Basic for Applications
- Microsoft Excel 16.0 Object Library
- OLE Automation
- Microsoft Office 16.0 Office Library
- Microsoft Outlook 16.0 Object Library
Any idea of what I am doing wrong here?
Thanks again.
Dennis
As I continue my studies into how to navigate the Outlook hierarchy using Excel VBA, I find that I often run into Run-time error '287':
Please forgive me for asking another question on this subject.
First, my understanding of the Outlook hierarchy is this:
Outlook Application
- Namespace
--- Address Lists
----- Address List
------- Address Entries
--------- Address Entry
If this is not correct, let me know as this might be the source of all my 287 errors.
Here is a snippet of my code:
VBA Code:
Dim olApp As Outlook.Application
Dim olNS As Outlook.Namespace
Dim olAddLists As Outlook.AddressLists
Dim olGAL As Outlook.AddressList
Dim olEntries As Outlook.AddressEntries
Dim olEntry As Outlook.AddressEntry
Set olApp = Outlook.Application
Set olNS = olApp.GetNamespace("MAPI")
Set olAddLists = olNS.AddressLists
For Each olGAL In olAddLists
Set olEntries = olGAL.AddressEntries
For Each olEntry In olEntries
…
Next
Next
The 287 error comes on the "Set olEntries" line.
I have Windows 10 and Office 2016.
Tools/References include:
- Visual Basic for Applications
- Microsoft Excel 16.0 Object Library
- OLE Automation
- Microsoft Office 16.0 Office Library
- Microsoft Outlook 16.0 Object Library
Any idea of what I am doing wrong here?
Thanks again.
Dennis