Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Excel file Save as .DBF
Message
From
03/10/2006 05:51:15
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
02/10/2006 12:46:04
Kay Alexander
Pennsylvania Farm Bureau
Pennsylvania, United States
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9
OS:
Windows XP
Network:
Novell 6.x
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01158600
Message ID:
01158803
Views:
21
>Hi,
>
>After opening the excel spredsheet with "oWorkbook=Getobject('c:\my documents\sample.xls')". Then, I am trying to save the file as DBF with "oWorkbook.SaveAs('c:\mydocuments\sample.dbf',...)" but I am not successful. I am referencing the book "Microsoft Office Automation with Visual FoxPro", and it describes, I need to use the file format as an optional second parameter with command "...SaveAs...". I tried many different possible ways for the second parameter, but none had worked.
>
>Thank you in advance.
>
>Kay

Kay,
1) Never use GetObject() but createobject() (search old messages for reasons detailed).
2)
-Open a new code window:
modi comm xlconstants.h
-Invoke object explorer and in explorer load excel com library
-Expand excel node
-Drag&drop constants node on to code window you opened
-Save xlconstants.h
-In code dealing with excel add:
#include xlconstants.h

Now you can say:

oExcel.ActiveWorkbook.SaveAs('c:\mydocuments\sample.dbf',xlDBF3)

3) To save as dbf you don't really need to use automation. You can use SPT or ADO.
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Reply
Map
View

Click here to load this message in the networking platform