Click here to Skip to main content
16,020,877 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am trying to use the Microsoft Access 12.0 Object library.
I go to Project/Add Reference/COM Tab and select Microsoft Access 12.0 Object Library then Ok. Now try as hard as I can, I can't access any of the objects in the library. The same goes for Microsoft Excel 12.0 Object library. Yet however, if I try Microsoft Excel 5.0 Object library it works. What am I doing wrong? What am I not doing that I should be doing?
Please help!!

Ken. :mad:
Posted

It sound like you don't have Excel 2007/Access 2007 installed on your machine (since the Excel 5.0 object library is working you do have a version of Excel installed). You need to use an object library for the version of Office you have installed (or for a previous version, since most Office object libraries are backwards compatibe)

If you do have Excel 2007/Access 2007 installed then you might have to install the Office Primary Interop Assemblies (see this MSDN howto[^])
 
Share this answer
 
Thanks Graham for your assistance.
I have Office Pro 2007 with everything installed.
Just to be safe, I downloaded the Office Primary Interop Assemblies and reinstalled them. By the way, to get it to install you have to rename "o2007PIA.msi" to "PIAredist.msi" (Thanks for that time waster Microsoft :~).
I still can't get it to do what I want. Maybe I'm confused about the difference between these two pieces of code:

VB
Dim objAccess As Object
Set objAccess = CreateObject("Access.Application")

which works and .....

VB
Dim oAccess As Access.Application
' Start a new instance of Access for Automation:
oAccess = New Access.ApplicationClass()


Which doesn't.

So I'll just carry on with the the first method.

Cheers.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900