lo_Excel = CREATEOBJECT("Excel.Application")
lo_Excel.Workbooks.ADD()
FOR EACH lo_Sheet IN lo_Excel.Sheets
? lo_Sheet.NAME
ENDFOR
lo_Excel.ActiveWorkbook.CLOSE()
lo_Excel.QUIT()
>I am doing some automation with excel and I am not sure how to find out how many sheets are in an excel workbook.
>
>ex:
>loExcel = createobject("excel.application')
>WITH loExcel
> .workbooks.sheets.count
>ENDWITH
>
>is the above correct. also how can I find out the name of each sheet.
>
>The problem is, I have to pick up these work sheets from the server each week and there are three sheets in the workbook and the name of the sheets may change, so I would like to dynamically figure out the name of the sheets and rename them. I know how to rename them.