Link to home
Start Free TrialLog in
Avatar of eagle23
eagle23

asked on

Excel Application in VFP

Please check out a portion of my vfp code regarding excel application in vfp.

appexcel=createobject('Excel.Application')
with appexcel
   .workbooks.open("c:\test\test.xls")
   .activeworkbook.saveas("c:\test\test.dbf,";
           "dbf4)
endwith

My intention is to save the excel file(.xls) in database format. But when I tried to run the program, I'm not getting the right result. Kindly help me on this matter.
ASKER CERTIFIED SOLUTION
Avatar of Cyril Joudieh
Cyril Joudieh
Flag of Lebanon image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of cbasoz
cbasoz

As Captain said second parameter is constant for FileFormat.

To supress excel dipslaying dialog for save :
 
#DEFINE xlDBF4 11
appexcel=createobject('Excel.Application')
with appexcel
  .DisplayAlerts = .F.
  .workbooks.open("c:\test\test.xls")
  .activeworkbook.saveas("c:\test\test.dbf",xlDBF4)
  .activeworkbook.saved = .t.
* .Quit
endwith
you can also create the cursor in foxpro and append from the excel file and copy to a dbf

CREATE CURSOR ...
APPEND FROM xlsfile TYPE XLS FIELDS field1, field2, field3, ...
COPY TO ...