| Author | Topic: Excel max.no of rows |
---|
| Gert Lutgert | Excel max.no of rows
on Sat, 28 Mar 2009 12:47:01 +0100Hello all.
Can anybody tell me how I can find the maximum
number of rows in an excelsheet.
I use CreateObject("Excel.Application") to create a
new workbook without knowing in advance which version
of excel is installed.
Regards, Gert |
| Bruce Anderson | Re: Excel max.no of rows
on Sat, 28 Mar 2009 12:53:43 -0500 |
| Bruce Anderson | Re: Excel max.no of rows
on Sun, 29 Mar 2009 07:01:34 -0500Sorry, I misread your question. These references deal with finding the last
row used on a worksheet, which is not what you want. |
| Gert Lutgert | Re: Excel max.no of rows
on Sun, 29 Mar 2009 17:12:48 +0200"Bruce Anderson" <banderson@graphical-db.com> wrote in
news:3b94e219$43ce9d16$1004b@news.alaska-software.com:
> Sorry, I misread your question. These references deal with finding the
> last row used on a worksheet, which is not what you want.
>
No problem!
Checking the VBA-routines did not solve my problem.
Thanks anyway!
This did:
FUNCTION Get_Highest_Row_Number ( oSheet )
LOCAL lError := .F.
LOCAL nHighest_Row_Number := 1
BEGIN SEQUENCE
Select a cellrange that doesn't exist in Excel 2003,
but only in 2007.
oSheet:Range("A65537"):Select()
RECOVER USING oError
lError := .T.
ENDSEQUENCE
IF !(lError)
nHighest_Row_Number := 1000000
ELSE
nHighest_Row_Number := 65536
ENDIF
RETURN (nHighest_Row_Number) |
| Thomas Braun
| Re: Excel max.no of rows
on Mon, 30 Mar 2009 10:47:43 +0200Gert Lutgert wrote:
> No problem!
> Checking the VBA-routines did not solve my problem.
>
> Thanks anyway!
>
> This did:
>
> FUNCTION Get_Highest_Row_Number ( oSheet )
Instead of catching the error, how about simply querying which version of
Excel is running by using the "Application" object?
Sample VBA-Code:
MsgBox "Welcome to Microsoft Excel version " & _
Application.Version & " running on " & _
Application.OperatingSystem & "!"
regards
thomas |
| Gert Lutgert | Re: Excel max.no of rows
on Mon, 30 Mar 2009 18:58:31 +0200Thomas Braun <spam@software-braun.de> wrote in news:1l3s1xh904y1y
$.11zlwplf7crab.dlg@40tude.net:
> Gert Lutgert wrote:
>
>> No problem!
>> Checking the VBA-routines did not solve my problem.
>>
>> Thanks anyway!
>>
>> This did:
>>
>> FUNCTION Get_Highest_Row_Number ( oSheet )
>
> Instead of catching the error, how about simply querying which version of
> Excel is running by using the "Application" object?
>
> Sample VBA-Code:
>
> MsgBox "Welcome to Microsoft Excel version " & _
> Application.Version & " running on " & _
> Application.OperatingSystem & "!"
>
> regards
> thomas
>
Hello Thomas,
I got your point.
But, how can i be sure that oExcel:version() will always return a number?
Wat if MS$ decides to release a 13.a or 13 Beta?
This way (via Errorchecking) I know ABS(olutely) if there are more
then 65536 rows available. The first followup (V12) has 1M rows
Thanks for the idea.
Regards, Gert |
| Thomas Braun
| Re: Excel max.no of rows
on Tue, 31 Mar 2009 09:32:50 +0200Gert Lutgert wrote:
> I got your point.
> But, how can i be sure that oExcel:version() will always return a number?
Agreed - you can't
Thomas |