Page 1 of 1 1
Topic Options
#146992 - 2005-09-01 07:46 PM Accessing Excel file
AstaaLavista Offline
Starting to like KiXtart

Registered: 2005-08-11
Posts: 111
Loc: Gujarat, India.
Hi,
I am trying to access an excel file. (Excel is installed)
Should I need anything other than Kixtart for reading from an excel application.
I m just not able to read the excel file.
N.B. I have tried many code scripts given on this side, but none seems to be working on my pc.
Even the script given in "Man, Do I feel stupid - Excel " works only when I use the WRONG option:
$Findit = $oXL.Range("A1:A500").Find(What:="$Server")

What should I do to read Excel from Kixtart on my machine?


Edited by Ziangi_Jones (2005-09-01 08:40 PM)

Top
#146993 - 2005-09-02 01:11 AM Re: Accessing Excel file
StarwarsKid Offline
Seasoned Scripter
*****

Registered: 2005-06-15
Posts: 506
Loc: Oregon, USA
This is a function created by Kent Dyer that will read excel files.

Code:
 ;FUNCTION READEXCEL()
;
;ACTION Reads an Excel Spreadsheet
;
;AUTHOR Kent Dyer (leptonator@hotmail.com)
;
;CONTRIBUTORS Alex, Frans Erich for the idea
;
;VERSION 1.4 - re-written for an array
;
;DATE CREATED 02-January-2002
;
;DATE MODIFIED 27-April-2003
;
;KIXTART 4.12
;
;SYNTAX READEXCEL('FILENAME')
;
;PARAMETERS $Filename
; XLS file
;
;DEPENDENCIES None
;
;RETURNS Values - $Value1, $Value2, $Value3
;
;REMARKS
;{Version 1.2 - Edit 06-April-2003 Added additional error-checking}
;{Version 1.1 - Edit 28-October-2002 fixed a "dispatch pointer" error}
;Ref - http://kixtart.org/cgi-bin/ultimatebb.cgi?ubb=get_topic&f=2&t=002715
;Ref - http://boards.cramsession.com/boards/vbm.asp?rpg=1&wpg=1&sb=0&pvm=False&m=447684
;
;EXAMPLE
;Tested on MS-Excel Files
;$cFile = "C:\Scripts\Test.XLS"
;Tested on CSV Files
;$cFile = "C:\Scripts\Test.CSV"
;READEXCEL($cFile)
;
;KIXTART BBS http://www.kixtart.org/board/ultimatebb.php?ubb=get_topic;f=12;t=000121

FUNCTION READEXCEL($cfilename)
DIM $Rc,$Row,$oXL
$a=1,3,2 ;columns and order to be read
IF 0=EXIST($cfilename) ;insure the file exists
?'Excel file not found'
SLEEP 4
RETURN ;leave
ENDIF
$oXL=Createobject('Excel.application')
;Check to insure that Excel is available
IF 0<>@error ?@error ' Excel Application is not found'
SLEEP 4
RETURN
ENDIF
$Rc=$oXL.workbooks.open($cfilename)
$Row=1 ;Row to start at using column headings, change to 0, if needed
WHILE $oXL.cells($Row,1).value<>'' ;need a value each time in column 1
$Row=$Row+1
IF $oXL.cells($Row,1).value='' ;Once it gets to a blank row...
$oXL.quit ;quit Excel
$oXL=0 ;set the object to 0
ELSE
$name=$oXL.cells($Row,1])
ENDIF
LOOP
$READEXCEL=$b
ENDFUNCTION



Browse the UDF library for more UDFs.
http://udf.isorg.com/
_________________________
let the wise listen and add to their learning,
and let the discerning get guidance- Proverbs 1:5

Top
#146994 - 2005-09-02 03:31 AM Re: Accessing Excel file
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
you could also try http://www.kixtart.org/UDF
_________________________
!

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
0 registered and 687 anonymous users online.
Newest Members
ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder, M_Moore
17887 Registered Users

Generated in 0.057 seconds in which 0.031 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