Re: Read from Excel file

From: Val Mazur (group51a_at_hotmail.com)
Date: 08/31/04


Date: Mon, 30 Aug 2004 20:51:22 -0400

Hi,

You would need to specify spread*** name in a SELECT. But if you do not
know name of it, then what you could do is to get spread*** names using
OpenSchema method of ADO Connection. ADO treats each spread*** inside of
Excel as a table and when you use OpenSchema, you should query for the table
names. But potential issues could be here because sometimes Excel itself
creates hidden spreadsheets inside of the file and when you use OpenSchema
to get list of the spreadsheets, then you could get more names, then you see
in a Excel. Check next KB about how to use OpenSchema method

http://support.microsoft.com/default.aspx?scid=kb;en-us;186246

-- 
Val Mazur
Microsoft MVP
"Elizabeta" <Elizabeta@discussions.microsoft.com> wrote in message 
news:48057292-78F1-4BC1-8F9F-B1B62D22F1EA@microsoft.com...
> Hi, all
>
> I am trying to use ado connection object to read an excel file.
>
> I am not sure how to do it.
>
> 1. I create connection with specified file name (that's easy)
> 2. open recordset based on the previous connection, to read one work***,
> like this
>    Set rs = cn.Execute("SELECT * FROM [Sheet1$]")
>
> My problem here is *** name. I don't want to specify it, because it is
> going to be modified. I would like to open just that one active ***,
> currently the only one in a workbook.
>
> So, the question is 'Is it possible to read active *** in excel file, 
> not
> knwing the ***'s name?'
>
> Or, is there any other way to do it?
>
>
>
> TIA
>