it found this sheet in xls file but after this method oExcel:WorkSheets( n ):Delete(). The DATA sheet is still exist in excel file. I don't know what does it wrong?
Regards,
Dutch
- Code: Select all Expand view
- #include 'fivewin.ch'
FUNCTION MAIN()
LOCAL oExcel, oSheet
LOCAL nRow, nSheets, n
LOCAL nCounter, nStart, nSeconds, nSecOle, nSecClip, nSecArray
LOCAL cMemo, cData, aData
set century on
set epoch to 1950
oExcel = CREATEOBJECT( "Excel.Application" )
oExcel:WorkBooks:Open("d:\fwh\samples\testxls.xls")
nSheets := oExcel:Sheets:Count()
for n := 1 to nSheets
if upper( oExcel:WorkSheets( n ):Name )=="DATA"
oExcel:WorkSheets( n ):Delete()
msginfo('delete')
end
next
oExcel:Visible := .T.
oExcel:Quit()
return nil