Hi there,
You must register and open the table without specifying the range.
Then use TableInfo to get the number of rows and columns of the table.
With that information you can close the table, register it with the correct
range
and open it.
I don't know if it's the best method, but it works fine.
Register Table sfileName Type "XLS" Into stableName
Open Table stableName
s_tab = TableInfo(0, TAB_INFO_NAME)
h = TableInfo(0, TAB_INFO_NCOLS) - 1
sRange = "A" + Str$(2) + ":" + Left$(Chr$(64+h\26),
int(h>25))+Chr$(65+h mod 26) + TableInfo(0,TAB_INFO_NROWS)
close Table s_tab
Register Table sfileName Type XLS Titles Range sRange Into
stableName
Open Table stableName
Best Regards,
Lu�s Marcos
-----Original Message-----
From: Christophe Brabant [mailto:[EMAIL PROTECTED]
Sent: quarta-feira, 18 de Maio de 2005 12:39
To: [email protected]
Subject: MI-L Registering Excel Table
Hi everyone
First, I would like to thank those who help me each time I need help.
Well, I would like to register an Excel table, like this :
Dim xls_file, tab_file As String
xls_file = "c:\temp\file.xls"
tab_file = "c:\temp\file.tab"
Register Table xls_file TYPE XLS Titles Range "A2:F6"
Open Table tab_file
....then compute the content of the table.....
This assumes of course that datas start always in first column.
BUT in this example, F6 is of course variable. It could be G55, or B477,
etc....it depends of the contents of Excel file.
The question is : how to know the number of lines and columns into the Excel
file, BEFORE registering it ? By this way I should compute the Range of
Excel cells :
Dim str_range As String
str_range = Chr$(65+nb_columns-1) + nb_lines ' where 65 is the ASCII code
of 'A'
This assumes too that 1 <= nb_columns <= 26
Thank you for your help, I hope that this problem will interest you.
Christophe
---------------------------------------------------------------------
List hosting provided by Directions Magazine | www.directionsmag.com |
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Message number: 16520