PDA

View Full Version : OleObject file Access in an Excel file



jailout
01-03-2012, 04:19 AM
HI Everybody,
I am working with an excel VBA application, I have an Access file inserted inside a sheet as an OLEObject file. My problem is that I would like to connect to that Access file using DAO or ADO, but I don't know how to do, because I don't know the reference to the OLEObject in order to fill the 'Data Source' field of the connection.

Someone knows what to do?

thanks, :hi:
bye

Bob Phillips
01-03-2012, 04:38 AM
Why are you embedding it, why not just connect to the .mdb?

jailout
01-03-2012, 05:56 AM
For practice, so I will work with only one file (the excel file) and not with 2 files (.xls and .mdb); I thought that it would be easy to reference the .mdb file in order to initialize the connection with ADO.

thanks anyway,

Bob Phillips
01-03-2012, 06:18 AM
Well, I have never tried, but I can imagine problems because the ADO connection string requires a source, which is usual a physical folder. working with 2 files is not a problem.

jailout
01-03-2012, 07:34 AM
I think that it 's necessary only the reference to the file, sometimes like WORKBOOK|SHEET1|OBJECT_NAME..............but I don't know.......

Bob Phillips
01-03-2012, 10:51 AM
Maybe you are right, but maybe you are wrong. There was certainly memory leak problems trying to access an open Excel workbook via ADO, goodness knows how it would cope with an embedded database in an open workbook.