View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
rob merritt rob merritt is offline
external usenet poster
 
Posts: 4
Default vb and excel as datasource

here is my code below everything goes well until

Set rst = oConn.Execute(strSQL)

it says it cant find the object 29-Dec-2003 (this is the worksheet
name for sure)
I have tried this with the sheet named ws1 and without the a2:5000
any ideas whats going on?

Private Sub Form_Load()
Dim rst As ADODB.Recordset
Dim oConn As ADODB.Connection
Set oConn = CreateObject("ADODB.Connection")
MsgBox App.Path & "\caretaker.xls"
strSQL = "SELECT * FROM [29-Dec-2003$a2:G500]"
oConn.Open "Driver={Microsoft Excel Driver (*.xls)};DriverId=790;Dbq="
& App.Path & "\caretaker.xls;DefaultDir=" & App.Path
Set rst = oConn.Execute(strSQL)