Page 1 of 1 1
Topic Options
#44406 - 2003-08-21 04:52 PM ReadExcel2 UDF
Wintermute Offline
Fresh Scripter

Registered: 2003-05-13
Posts: 11
I am examining the use of this UDF to read information from a single cell (i.e. Row 5, Column 7) within a spreadsheet and assign it to a variable. Then I want to display the result in a KiXform.

I have noticed that the stated action of this function is to read values from Excel to a 2-dimensional array.

In testing it with KiXtart version 4.21 and windows 2000, I have been unable to get it pull a single value out of a spreadsheet and display it. Am I using the function in a manner other than what it was designed for?

I will post the code if I am using the function as intended. If I am not, can anyone suggest a function that will read a specific cell by coordinated in Excel? I examined the ReadExcel UDF, but I'm not sure from reading the description that it will perform what I need. Can anyone shed some light on the best UDF for my situation?

Top
#44407 - 2003-08-21 05:20 PM Re: ReadExcel2 UDF
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Hi Winter, might try this little snippet. It reads a spreadsheet called TEST.XLS in the current script directory.

code:
break on

$excel = createobject("excel.application")
$excel.visible = 0
$excel.displayalerts = 0

$book = $excel.workbooks.open("@SCRIPTDIR\TEST.XLS")

if $book

$value = $excel.activesheet.columns(7).rows(5).value

?"Value=" $value

endif

$excel.visible = 0
$excel.quit()
$excel = 0

exit 1


Top
#44408 - 2003-08-21 05:36 PM Re: ReadExcel2 UDF
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
So, what does
code:
$value=READEXCEL2('file.xls', 1, 1, 1, 5, 7)
? ubound($value,1)
? ubound($value,2)
? $value[0,0]

give?
_________________________
There are two types of vessels, submarines and targets.

Top
#44409 - 2003-08-25 05:14 PM Re: ReadExcel2 UDF
Wintermute Offline
Fresh Scripter

Registered: 2003-05-13
Posts: 11
Thank-you Shawn! That is returning values to the console from the spreadsheet. The UDF ReadExcel2 was not, I suspect it is more suited to reading more than one cell.

Anyway, not a problem any longer as the code supplied works just fine.

Top
#44410 - 2003-08-25 06:13 PM Re: ReadExcel2 UDF
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
wintermutter, it does not matter what I intended it for.
the point is, that it should work.
if it doesn't, I shall fix it.

did you test with jens' lines?
_________________________
!

download KiXnet

Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
1 registered (Allen) and 1047 anonymous users online.
Newest Members
Viginette, ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder
17888 Registered Users

Generated in 0.064 seconds in which 0.034 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org