Excel Sheet-name check

Excel Sheet-name check

Postby Marc Vanzegbroeck » Wed Aug 03, 2016 9:08 am

Hi,

How can I check if a sheet with a specific name exist in an excel workbook, and select it, if exist?
If not exist, I need to do something else..
Regards,
Marc

FWH32+xHarbour | FWH64+Harbour | BCC | DBF | ADO+MySQL | ADO+MariaDB | ADO+SQLite
Marc Vanzegbroeck
 
Posts: 1159
Joined: Mon Oct 17, 2005 5:41 am
Location: Belgium

Re: Excel Sheet-name check

Postby hmpaquito » Wed Aug 03, 2016 9:46 am

Marc,

Try so, (no tested)
Code: Select all  Expand view

FUNCTION ExcelSheetNames(oExcel)
Local aNames:= {}
Local nLen:= oExcel:WorkSheets:Count
Local cName

FOR nI:= 1 TO nLen
   cName:= oExcel:WorkSheets(nI):Name
   Aadd(aNames, cName)

NEXT
RETURN aNames


Regards
hmpaquito
 
Posts: 1482
Joined: Thu Oct 30, 2008 2:37 pm

Re: Excel Sheet-name check

Postby Marc Vanzegbroeck » Wed Aug 03, 2016 9:55 am

Thank you. With the loop into the worksheets, I can test if a sheet exist.
Now It's working fine :D

hmpaquito wrote:Marc,

Try so, (no tested)
Code: Select all  Expand view

FUNCTION ExcelSheetNames(oExcel)
Local aNames:= {}
Local nLen:= oExcel:WorkSheets:Count
Local cName

FOR nI:= 1 TO nLen
   cName:= oExcel:WorkSheets(nI):Name
   Aadd(aNames, cName)

NEXT
RETURN aNames


Regards
Regards,
Marc

FWH32+xHarbour | FWH64+Harbour | BCC | DBF | ADO+MySQL | ADO+MariaDB | ADO+SQLite
Marc Vanzegbroeck
 
Posts: 1159
Joined: Mon Oct 17, 2005 5:41 am
Location: Belgium


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 75 guests