Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Excel Ole Automation
Message
From
02/06/1998 02:48:02
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
01/06/1998 23:50:59
Ken Zockoll
FactSet Research Systems, Inc.
New York City, New York, United States
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00103800
Message ID:
00103881
Views:
22
Ken,
It seems MS KB can make it harder than it's. To get an excel constant in fact there is a shorter way (timely - not as short as MS could publish them).
-Open excel
-Select tools\macro\VB editor
-Press F2, object browser launches
-In the lower part there are two windows (class - members)
-In class window find constant group (xlFileFormat)
-In right window click member (xlDBF4)
-Value is displayed beneath the window (11)
Cetin

>>I can not get excel to save a excel worksheet as a DBF file via VFP.
>>Any help would be appreciated.
>>
>>Excel Worksheet SaveAs method syntax:
>>expression.SaveAs(Filename, FileFormat, Password, WriteResPassword, ReadOnlyRecommended, CreateBackup, AddToMru, TextCodePage, TextVisualLayout)
>>
>>Note: the TextCodePage and TextVisualLayout parameters do not apply the the U.S. version of Excel
>>
>>my Code:
>>ox.Sheets('Changes').SaveAs('c:\temp\test.dbf','xlDBF4' ,' ', ' ', .f. , .f. , .t. )
>>
>>
>>VBA Macro to save as DBF file as it appears in Excel:
>>
>>ActiveWorkbook.SaveAs FileName:="C:\temp\test.dbf", FileFormat:=xlDBF4, CreateBackup:=False
>
>Via Microsoft KB
>
>How To Determine FileFormat Values for Excel SaveAs Method
>Last reviewed: October 29, 1996
>Article ID: Q157721
>The information in this article applies to:
>Microsoft Visual FoxPro for Windows, versions 3.0, 3.0b, 5.0
>
>
>SUMMARY
>Visual Basic for Excel Help often specifies constant names rather than values to be used in calling object methods. When performing OLE Automation from Visual FoxPro, FoxPro does not understand these constants and, therefore, requires their initial values.
>
>Below are the steps used to determine what the constant value is for a specific file format to be used for the FileFormat portion of the SaveAs method.
>
>
>
>MORE INFORMATION
>
>Create a worksheet in Excel and save it in the format that you want. Make sure that you close the file before continuing.
>
>Issue the following commands in Visual FoxPro:
>
>
> * First get an object reference to the Excel application
> oXL = CREATEOBJECT("Excel.Application") && starts excel
>
>
> * Open the worksheet created in step 1 (be sure to include
> * the full path and file name
> oXL.WorkBooks.Add("myfile.xls")
>
>
> * Retrieve the FileFormat
> nFileFormat = oXL.WorkBooks(1).FileFormat
>
>
> * Save the file under a new name with the same format
> oXL.WorkBooks(1).SaveAs("new.xls",nFileFormat)
>
>
> * Quit Excel
> oXL.Quit
>
>
> * Release the object reference
> RELEASE oXL
Ç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
Next
Reply
Map
View

Click here to load this message in the networking platform