How can I read from multiple worksheets on Excel?

forum.3rdparty.tools (2005-2010)
Coco Sanchez

How can I read from multiple worksheets on Excel?

Post by Coco Sanchez » 16 Apr 2009, 07:11

 Posted by:  Coco Sanchez 

Hi All,

How can I read / retrieve data from multiple worksheets on an Excel file.

These are jsut part of the codes on what we are currently using to read only
from the first worksheet on an Excel file:

Set bReturn = gExcelApp.PropGetWorkbooks( gExcelWorkbooks )
Set bReturn = gExcelWorkbooks.Open( psFileName,,,,,,,,,,,,,gExcelWorkbook )
Call gExcelWorkbook.PropGetActiveSheet( oXSheet )

We are using GTD4.2.

Thanks in advance for any help you could provide.

Regards.
Coco

Dave Rabelink
Founder/Site Admin
Founder/Site Admin
Netherlands
Posts: 3352
Joined: 24 Feb 2017, 09:12
Location: Gouda, The Netherlands

Re: How can I read from multiple worksheets on Excel?

Post by Dave Rabelink » 16 Apr 2009, 23:54

Try this :

Call gExcelWorkbook.PropGetWorksheets( gExcelSheets )
Call gExcelSheets.PropGetCount( nTotalSheets )

! Set variant to index of the sheet (1=first sheet, 2=second and so on
up to total sheets)

Set nIndex = 1
Call uVariant.SetNumber( nIndex, VT_I2 )
Call gExcelSheets.PropGetItem( uVariant, gExcelSheet )

Regards,
Dave

Return to “3rdparty.tools”

Who is online

Users browsing this forum: [Ccbot] and 0 guests