Discussion Locked

Opening a connection in VB to Excel

0 helpful
2 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

What is the best way to open a connection,and execute a SQL command on an excel spreadsheet?

I don't seem to have a problem opening the connection, but when I attempt to open a recordset using this connection : rsOpenACT.Open "Select * from Spreadsheet" I get an Error :"[Microsoft][ODBC Excel Driver]. The Microsoft Jet database engine could not find the object 'Spreadsheet'. Make sure the object exists and that you spell its name and the path name correctly."

I think all I really need is a sample Connection String, and a sample Recordset.Open method.

2 replies

by jim.schromm

It would seem to me that your path or query is not defining the Sheet name within the Excel file to return. Each sheet acts as a table.

by shanghai sam

It's the specific syntax that I'm looking for. How do I define the Sheet name within the Excel file in the connection string?

This discussion is closed to new replies.