E
E
Emil Revencu2018-10-30 20:43:13
excel
Emil Revencu, 2018-10-30 20:43:13

How to get first sheet name in Excel using VBScript OpenSchema?

I have an excel file with several sheets .
I need to open the first sheet through VBS
. My code is:

strConn="Provider=Microsoft.ACE.OLEDB.12.0;Data Source=file.xlsx;Extended Properties=""Excel 12.0; ReadOnly=true; HDR=No;IMEX=1"""
Set conn = CreateObject("ADODB.Connection")
conn.Open strConn
set tables = conn.OpenSchema(20)
      do until tables.eof
      wscript.echo tables("TABLE_NAME")
      tables.movenext
      loop

Returns a list of the names of all sheets but in alphabetical order
How can I find out the order index of a sheet in a document?
You need to open the first sheet. In the resulting list of sheet names, he is not the first

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
Pychev Anatoly, 2018-10-30
@pton

Is it necessary to use ADODB?
Create an Excel object right away

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question