FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour GetExcelRange function
Posts: 434
Joined: Wed Jun 06, 2007 02:58 PM
GetExcelRange function
Posted: Fri Aug 31, 2018 07: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 24.02 - Feb. 2024 - Embarcadero C++ 7.60 for Win32 Copyright (c) 1993-2023

FWH 64 for Harbour 19.06 (MSVC++) Jun. 2019 - Harbour 3.2.0dev (r1904111533)

Visual Studio 2019 - Pelles C V.8.00.60 (Win64)
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: GetExcelRange function
Posted: Fri Aug 31, 2018 09:21 AM
Code (fw): Select all Collapse
FOR i = 1 TO oExcel:Sheets:Count
    oExcel:Sheets( i ):Select()
    // do something with this sheet
NEXT


EMG
Posts: 434
Joined: Wed Jun 06, 2007 02:58 PM
Re: GetExcelRange function
Posted: Fri Aug 31, 2018 02:13 PM
thank you Enrico,
I tried this and works:
Code (fw): Select all Collapse
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 24.02 - Feb. 2024 - Embarcadero C++ 7.60 for Win32 Copyright (c) 1993-2023

FWH 64 for Harbour 19.06 (MSVC++) Jun. 2019 - Harbour 3.2.0dev (r1904111533)

Visual Studio 2019 - Pelles C V.8.00.60 (Win64)

Continue the discussion