GetExcelRange function

GetExcelRange function

Postby damianodec » Fri Aug 31, 2018 7:26 am

hi,
I know that GetExcelRange function works with this parameters ( cBook, cSheet, acRange, lOpened ) function defaults to ActiveWorkBook, ActiveSheet and UsedRange, if the corresponding parameters are not specified.
I Have a lot of excel files (cBook) and inside there are 1 or n sheets (cSheet), is there any way to open them (sheets) sequentially by FOR NEXT ?
FiveWin for xHarbour 17.09 - Sep. 2017 - Embarcadero C++ 7.00 for Win32
FWH 64 for Harbour 19.06 (MSVC++) Jun. 2019 - Harbour 3.2.0dev (r1904111533)
Visual Studio 2019 - Pelles C V.8.00.60 (Win64)
User avatar
damianodec
 
Posts: 419
Joined: Wed Jun 06, 2007 2:58 pm
Location: Italia

Re: GetExcelRange function

Postby Enrico Maria Giordano » Fri Aug 31, 2018 9:21 am

Code: Select all  Expand view  RUN
FOR i = 1 TO oExcel:Sheets:Count
    oExcel:Sheets( i ):Select()
    // do something with this sheet
NEXT


EMG
User avatar
Enrico Maria Giordano
 
Posts: 8719
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: GetExcelRange function

Postby damianodec » Fri Aug 31, 2018 2:13 pm

thank you Enrico,
I tried this and works:
Code: Select all  Expand view  RUN

oExcel   := ExcelObj()
oBook    := oExcel:WorkBooks:Open( cFile )
nSheet = oBook:Worksheets:Count()
FOR nFogli = 1 to nSheet
    cSheetName = oBook:Worksheets(nFogli):Name()
        oRange  := GetExcelRange(cFile, cSheetName , , @lOpened )
...
...
 
FiveWin for xHarbour 17.09 - Sep. 2017 - Embarcadero C++ 7.00 for Win32
FWH 64 for Harbour 19.06 (MSVC++) Jun. 2019 - Harbour 3.2.0dev (r1904111533)
Visual Studio 2019 - Pelles C V.8.00.60 (Win64)
User avatar
damianodec
 
Posts: 419
Joined: Wed Jun 06, 2007 2:58 pm
Location: Italia


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 33 guests