N
nate axtell
I am opening a client-side Excel file using ADO in VBScript like so:
XLSfile = "path to file"
Set Conn = CreateObject("ADODB.Connection")
Conn.ConnectionString = "DBQ=" & XLSfile & _ ";DRIVER=Microsoft Excel
Driver(*.xls);UID=admin;"
Conn.Open
To query from a default datasheet name you would make a SQL string like
"SELECT * FROM [Sheet1$]".
I need to get the name of the worksheet from the Conn object somehow, so
that my Sheet1 name can be dynamic. Is there a way to get a collection of
the worksheets in an Excel file using this connection object? That way I
could specify something like "Select * From ["&sheetname&"$]".
If I can't use this driver to do the above is there another ADO driver that
I could use?
Thanks,
Nate
XLSfile = "path to file"
Set Conn = CreateObject("ADODB.Connection")
Conn.ConnectionString = "DBQ=" & XLSfile & _ ";DRIVER=Microsoft Excel
Driver(*.xls);UID=admin;"
Conn.Open
To query from a default datasheet name you would make a SQL string like
"SELECT * FROM [Sheet1$]".
I need to get the name of the worksheet from the Conn object somehow, so
that my Sheet1 name can be dynamic. Is there a way to get a collection of
the worksheets in an Excel file using this connection object? That way I
could specify something like "Select * From ["&sheetname&"$]".
If I can't use this driver to do the above is there another ADO driver that
I could use?
Thanks,
Nate