Painkiller
Programmer
Hi all
I was wondering if someone could help me with this:
I'm trying to open an excel file in a VB program, and I don't know how to open a specific column from the worksheet in a recordset! I'm using the following code:
Set cnExcelConnection = New ADODB.Connection
With cnExcelConnection
.Provider = "Microsoft.jet.OLEDB.4.0"
.ConnectionString = "Datasource=C:\ProgramFiles\Microsoft Visual Studio\VB98\autoprijzen_mei01.xls;Extended Properties=Excel 8.0;"
.Open
End With
Set rsToplease = New ADODB.Recordset
'open recordset
rsToplease.Open "select * from [toplease$]", cnExcelConnection, adOpenDynamic, adLockOptimistic
Now I'm trying to replace the '*' symbol in the SQL statement with a specific column form the worksheet, but using names such as 'A' or 'B' doesn't work. Can anybody help me out?
I was wondering if someone could help me with this:
I'm trying to open an excel file in a VB program, and I don't know how to open a specific column from the worksheet in a recordset! I'm using the following code:
Set cnExcelConnection = New ADODB.Connection
With cnExcelConnection
.Provider = "Microsoft.jet.OLEDB.4.0"
.ConnectionString = "Datasource=C:\ProgramFiles\Microsoft Visual Studio\VB98\autoprijzen_mei01.xls;Extended Properties=Excel 8.0;"
.Open
End With
Set rsToplease = New ADODB.Recordset
'open recordset
rsToplease.Open "select * from [toplease$]", cnExcelConnection, adOpenDynamic, adLockOptimistic
Now I'm trying to replace the '*' symbol in the SQL statement with a specific column form the worksheet, but using names such as 'A' or 'B' doesn't work. Can anybody help me out?