This is some simple code I use to rip data from an Excel spreadsheet
Any use?
If messagebox("Import Suppliers",36,"Please confirm")=6
cFilename=getExFile("d:\suppliers.xls") && getexfile just does a
locfile
is the path is wrong
If !isnull(cFilename)
Sele 0
Use supplier
Zap
oXL=CREATEOBJECT("Excel.Application")
oWB=oXL.Workbooks.open(cFilename)
oWS=oWB.ActiveSheet
nMax=0
For EACH oRow IN oWS.Rows
If oRow.row=1
Loop
Endif
If empty(oRow.cells[1,1].value)
Exit
Endif
Append blank
Scatter memvar memo
m.changed_by="System"
m.changed_date=date()
m.created_by="System"
m.created_date=date()
m.su_add1=oRow.cells[1,4].value
m.su_add2=oRow.cells[1,5].value
m.su_add3=oRow.cells[1,6].value
m.su_add4=oRow.cells[1,7].value
m.su_add5=oRow.cells[1,8].value
m.su_add6=""
m.su_contact=""
m.su_email=""
m.su_fax=oRow.cells[1,13].value
m.su_ref=oRow.cells[1,1].value
m.su_telno=oRow.cells[1,12].value
m.su_vatcode="S"
m.su_vatrate=17.5
m.su_pcode=oRow.cells[1,9].value
m.su_name=oRow.cells[1,2].value
Gather memvar memo
Wait window m.su_name nowait noclear
Next
Use in supplier
Release oWS
Release oWB
Release oXL
Endif
Endif
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Behalf Of NickC
Sent: 14 March 2008 14:54
To: 'ProFox Email List'
Subject: RE: Getting at Excel data from VFP
Hi Tracy,
The only reason for not installing Excel is that it is a Server that this
will run on; I am of the opinion that installing any MS Office product on a
server comprimises its security. However, if there is an Excel 'Data part'
install that would be fine, unfortunately I can't fine anything like that.
Nick
> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf
> Of Tracy Pearson
> Sent: 14 March 2008 14:16
> To: [email protected]
> Subject: RE: Getting at Excel data from VFP
>
> Disclaimer: I'm not a lawyer.
>
> Check into the licensing of Excel. Isn't there a part in there you can
> install it on multiple machines (up to 3 I think) as long as you are the
> only one using it, and only one instance at a time. Wouldn't this fall
> into
> that technically? You did mention this runs on its own in the middle of
> the
> night when most people which work in the office will be asleep.
>
> Tracy
>
> -----Original Message-----
> From: NickC
> Sent: Friday, March 14, 2008 10:11 AM
>
> Excel is being used as a database. The initial problem with Append From
> is
> that on the first column (Id field) it adds a CHR(0) at the front of the
> field and chops off the last character.
>
> Nick
>
>
>
[excessive quoting removed by server]
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/profox
OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: http://leafe.com/archives/byMID/profox/[EMAIL PROTECTED]
** All postings, unless explicitly stated otherwise, are the opinions of the
author, and do not constitute legal or medical advice. This statement is added
to the messages for those lawyers who are too stupid to see the obvious.