Dim cell As String
chan_num = DDEInitiate("EXCEL", "Report 1")
OnError GoTo 0
' print cell
row_col = "R"+(6+i)+"C5"
cell = DDERequest$( chan_num, row_col)
print row_col+":"+cell
next
Note "ERROR! Excel not open!"
End Program
Lähettäjä: Warren Vick, Europa Technologies Ltd. [mailto:[EMAIL PROTECTED]
Lähetetty: 18. toukokuuta 2006 11:13
Vastaanottaja: Huotari Markku; [email protected]
Aihe: RE: [MI-L] Reading values from Excel with MapBasic
Warren Vick
Europa Technologies Ltd.
http://www.europa-tech.com
Tel: +44 20 8398 3955 x201
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED]
Sent: 18 May 2006 08:12
To: [email protected]
Subject: [MI-L] Reading values from Excel with MapBasicHi,
I'm trying to scan through an open Excel-document with MapBasic and collect a range of values from a specific column to be used in MapBasic, but the only way I seem to get it work is cell by cell by assigning each DDERequest$ with single row & column numbers (see the commented lines below).
What I do need is to get the DDERequest$ working in a loop where I scan through several rows of the same column. I'm jammed with this code that keeps on complaining about the run command "..." - it doesn't seem to assign any value to the cell variable. The print-commands output of the string "cell = ..." Looks OK to me...
I've started to wonder whether there are limitations in using variable names combined with the "run command"?
- - -
Dim chan_num, i, nro As Integer
Dim cell As StringOnError GoTo no_connection
chan_num = DDEInitiate("EXCEL", "Report 1")
OnError GoTo 0' cell = DDERequest$( chan_num, "R7C2" )
' print cellfor i = 1 to 100
print "cell = DDERequest$( "+chan_num+", ""R"+(6+i)+"C5"" )"
run command "cell = DDERequest$( "+chan_num+", ""R"+(6+i)+"C5"" )"
print cellnext
DDETerminateAll
End Program
no_connection :
Note "ERROR! Excel not open!"
End Program- - -
One possibility of course would be to import the excel-document to MapInfo, but since I've learned that it's possible to read the excel-document directly I thought I'd give this a try. Any ideas anybody?
I'm using MapInfo 7.5 and MapBasic 5.5 - and yes I know - I should upgrade - working on that too :)
_\////
(o o)
- - - - - - - - -ooOO -(__) -OOoo - - - - - - - - - - -
YTV - Pääkaupunkiseudun yhteistyövaltuuskunta
http://www.ytv.fi
- - - - - - - - - - - - - - - - - - - - - - - - - - - -
Markku Huotari YTV, liikenneosasto
[EMAIL PROTECTED] Tietotekniset palvelut
www.geocities.com/houtari Opastinsilta 6 A
puh. (09) 156 1219 00520 HELSINKI
- - - - - - - - - - - - - - - - - - - - - - - - - - - -
_______________________________________________ MapInfo-L mailing list [email protected] http://www.directionsmag.com/mailman/listinfo/mapinfo-l
