Subject Re: IMPORTING FILES
From Bernard Mouille <mouille_bernard@hotmail.com>
Date Tue, 23 Jun 2020 16:06:38 -0400
Newsgroups dbase.getting-started
Attachment(s) Test.txt

Hello Cornelius,

To open a dbf file with Excel, It works with Excel 2007 and dbf type 3.

Maybe the attached code can help you.

Regards,

Bernard

Cornelius Wrote:
> >
> Hi  Andy.
> Thanks for the answer. THe older excel alloed me to import dbf files but the newel version does not.
> I would like to know more about option 2.
>
> Thanks,
>
> Cornelius.
>
>




/*
   Test.prg
   Open a dbf table with Excel 2007.
   This code is a basic sample.

   With Excel 2007, i can not save to dbf.
   I do not know if it works with Office 365.
*/

DROP TABLE "_Result3"
DROP TABLE "_Result7"

CREATE TABLE "_Result7" (;
                      SALESID CHAR(6), ;
                      CUSTOMERID CHAR(10), ;
                      ORDERDATE DATE, ;
                      ORDERNMBR NUMERIC(7,0), ;
                      ORDERAMT NUMERIC(9,2), ;
                      DELIVERED BOOLEAN)

//sele 1
use _Result7.dbf
append blank
replace SALESID    with "A25"
replace CUSTOMERID with "Allan"
replace ORDERDATE  with date()
replace ORDERNMBR  with 1258
replace ORDERAMT   with 25.78
replace DELIVERED  with false

appe blank
replace DELIVERED with true // Look null fields.

copy to _Result3.dbf dbmemo3
use

oExcel = new OleAutoClient( "Excel.Application" )
oBook  = oExcel.WorkBooks.open( set( "directory" ) + "\_Result3.dbf" )
oExcel.Visible = true

return