How can I read from multiple worksheets on Excel?

forum.3rdparty.tools (2005-2010)
NewsgroupServer
Robot
Robot
Posts: 118939
Joined: 24 Feb 2017, 12:00
Location: World wide

How can I read from multiple worksheets on Excel?

Post by NewsgroupServer » 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

NewsgroupServer
Robot
Robot
Posts: 118939
Joined: 24 Feb 2017, 12:00
Location: World wide

How can I read from multiple worksheets on Excel?

Post by NewsgroupServer » 16 Apr 2009, 23:54

 Posted by:  Dave Rabelink 

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 [Crawler] and 0 guests