Hi Graham
Just FYI, but you could use INSERT-SQL to do that bypassing the APPEND
BLANK, the SCATTER, the memory variable re-assignments and the GATHER
lines.
> Message: 7
> Date: Fri, 14 Mar 2008 15:04:46 -0000
> From: "Graham Brown \(CompSYS\)" <[EMAIL PROTECTED]>
> Subject: RE: Getting at Excel data from VFP
> To: [EMAIL PROTECTED]
> Message-ID: <[EMAIL PROTECTED]>
> Content-Type: text/plain; charset="us-ascii"
>
> 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
>
_______________________________________________
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.