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!

'Compile error: Object library feature not supported' opening Outlook calendar 1

Status
Not open for further replies.

PeDa

Technical User
Oct 10, 2002
227
NL
Our Access application, recently migrated from Office 2010 to Office 2016, reads the users Outlook calendar
Code:
Dim MyApp As Outlook.Application
Dim MyNS As Outlook.Namespace
Dim MyFolder As MAPIFolder
Dim MyItems As Items

Set MyApp = CreateObject("Outlook.Application")
Set MyNS = MyApp.GetNamespace("MAPI")
Set MyFolder = MyNS.GetDefaultFolder(olFolderCalendar) 'find calendar
Set MyItems = MyFolder.Items ' find all appointments

This had been working for years in Office 2010, and works fine for me in Office 2016 (.accdb copied from network share to local C:), however ALL the other users, get the above message at "Set MyApp". Any possible explanations welcome.
 
Since you seem to be trying to do late binding (but are in fact doing early binding), try:

Code:
[blue]Dim MyApp As Object
Dim MyNS As Object
Dim MyFolder As Object
Dim MyItems As Object[/blue]

Or, if happy with early binding, try:

Code:
[blue]Set MyApp = New Outlook.Application[/blue]
 
Hello strongm,
Thank you for this (I see I must read up on Early and Late Binding!). I have just implemented your first suggestion, but "unfortunately" my original code was working today for the two colleagues present (I had the feeling that it was sometimes working and sometimes not; why else was it working for me, but not for the others?). Extensive use in the near future will hopefully reveal that you have solved my problem
-Peter D.
 
Check references, you definitely had code that referenced outlook library. In case consistent late binding replace [tt]olFolderCalendar[/tt] by [tt]9[/tt] too.


combo
 
Upon reading up on Early and Late Binding, decided to go for early binding. I do reference the Outlook library (and generating mail messages from VBA does work consistently).
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top