ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   DAO objects with late binding in Excel? (https://www.excelbanter.com/excel-programming/274959-dao-objects-late-binding-excel.html)

Chris

DAO objects with late binding in Excel?
 
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



All times are GMT +1. The time now is 11:01 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com