DAO objects with late binding in Excel?

C

Chris

Hi there,
I am trying to write a macro that will take info from
excel and write it to an access database. The macro will
be used by people who don't have Access on their
computers, and who don't have references to the DAO object
library. I can get it to work if they go into the VB
editor and select Tools/references and set the reference,
but I would prefer not to have to walk everyone through
that process.
I am thus trying to declare my objects as generic object
types and use late binding like thus:

Sub input()
Const Path As String = "C:\Test\LoginTest.mdb"
Dim db As Object
Dim rs As Object
Dim objAcc As Object
Dim ws As Object

Set objAcc = CreateObject("DAO.DBEngine")
Set db = objAcc.OpenDatabase(Path)
Set rs = db.OpenRecordset("Control Table")
rs![Control Processor]=Range("A1").value
rs.Close
db.Close
Set objAcc = Nothing
End Sub

But when I get to the OpenDatabase method part, I keep
getting "Out of memory" error. Anyone know how I could
accomplish my goal?

TIA
Chris
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top