Try .Sheets.Count
In Excel, use the VBA Object Browser and drill down to sheets. You should get the details there.
I know Excel defaults to 3 sheets when it opens a new workbook, but you are opening a old file.
If you are addressing a sheet by using the name Excel has assigned, be careful.
I have seen Excel change the 'Sheet 1' to 'Sheet 2' when I created a chart. All my data references for the chart were pointing to Sheet 1. I assigned Sheet 1 a name and referred the sheet name and everything worked fine.
>I use the following code to open an Excel Workbook from VFP:
>
>ExcelObj = CreateObject('Excel.Application')
>ExcelObj.Visible = .T.
>ExcelObj.Workbooks.Open("D:\TEST.XLS")
>
>Does anyone know of a way to return the number of WORKSHEETS in the open workbook? I can't seem to find an object property that tells me this.
>
>Thanks
Previous
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only