Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Excel Named Range Over Multiple Pages Has Not Enough Row
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Divers
Thread ID:
01121479
Message ID:
01121947
Vues:
20
This message has been marked as the solution to the initial question of the thread.
Try
? oRange.Areas.Count
FOR i=1 TO oRange.Areas.Count
  ? oRange.Areas.Item(i).Rows.Count
ENDFOR
>I have an Excel 2003 (SP2) workbook with one worksheet. That one worksheet is two pages long. I have a named range, called "PCNS", that covers column A, rows 10 thru 15 AND column A on the second page, rows 100 thru 110. That should mean the "PCNS" range covers 15 rows, correct? Well, when I run the following, it only shows me the first 5 rows. Anyone know how to show all 15 rows???
>
>Here is the defined range in Excel.
>
>
>='Sheet1'!$A$10:$A$15,'Sheet1'!$A$100:$A$110
>
>
>
>CLEAR
>SET ESCAPE ON
>
>oExcel= CREATEOBJECT("Excel.Application")
>oWorkBook = oExcel.WorkBooks.OPEN("MyExcel.xls", .F., .T.)    &&Don't update links, and readonly.
>
>oRange = oExcel.RANGE("PCNS")
>? oRange.ROWS.COUNT, "rows"
>? oRange.COLUMNS.COUNT, "columns"
>?
>FOR nRow = 1 TO oRange.ROWS.COUNT
>	FOR nColumn= 1 TO oRange.COLUMNS.COUNT
>		? nrow, ncolumn, oRange.Cells[nRow, nColumn].VALUE
>	ENDFOR
>ENDFOR
>
>oExcel.ActiveWorkbook.Close(0)		&&Close without saving!
>oExcel.QUIT()
>RELEASE oRange
>RELEASE oWorkBook
>RELEASE oExcel
>
--sb--
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform