Arryel,
Check this recent thread
Re: Knowing the workbook name Thread #
1201694 Message #
1201709If you have Excel installed, then it's easy to get sheet names. Otherwise I'm not sure. I don't know if Michel was able to solve the problem.
>Hi,
>
>Working on an Excel data extraction project. The Excel worksheet may have several sheets that all need to read data from.
>
>I've gotten to the the point where I need to know the sheet names to be used for the select statement for the InitRecordset.
>
>Here is my sample code:
>
>LOCAL oXLSConnect, oRecXLS, oXLSRS
>oXLSConnect = CREATEOBJECT('adodb.connection')
>oXLSConnect.cConnectionString = [Provider=Microsoft.Jet.OLEDB.4.0;Data Source=] ;
> + GETFILE() + [;Extended Properties="Excel 8.0;HDR=Yes;IMEX=1";]
>oXLSConnect.Open
>
>oRecXLS = CREATEOBJECT('veRecHandler')
>lcSqlCmd = "select * from [" + TRIM(sheet_name) + "]"
>oXLSRS = oRecXLS.InitRecordSet(adUseClient, adOpenStatic, adLockOptimistic, lcSqlCmd, oXLSConnect)
>oRecXLS.Rs2Cusror(oXLSRS, "C_" + TRIM(table_name))
>
>
>
>Any help is greatly appreciated.
>
>Regards,
>Ariel
If it's not broken, fix it until it is.
My Blog