Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How many sheets in an Excel Workbook
Message
From
01/07/1999 14:39:56
 
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00236598
Message ID:
00236617
Views:
9
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
Map
View

Click here to load this message in the networking platform