Click to See Complete Forum and Search --> : Using ADO to access MSExcel


kuvo
August 5th, 1999, 04:13 PM
Hi,
This is how I open a table called "employees" in my database,
and it works fine.
Now, I want to access a worksheet named "sheet1$" in my Excel file,
and I have problem with that. Can you help me out ? Thanks



Dim cnnExcel As ADODB.Connection
Dim cmdExcel As ADODB.Command
Dim rsExcel As ADODB.Recordset

cnnExcel.ConnectionString = strCnn
cnnExcel.ConnectionTimeout = 30
cnnExcel.Open strCnn

rsExcel.CursorLocation = adUseServer
rsExcel.LockType = adLockReadOnly

rsExcel.Open "employees", cnnExcel, , , adCmdTable