Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Excel Ole Automation
Message
De
05/06/1998 00:07:38
Ken Zockoll
FactSet Research Systems, Inc.
New York City, New York, États-Unis
 
 
À
02/06/1998 02:48:02
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00103800
Message ID:
00105003
Vues:
110
>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
Thanks for the tip!



>>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
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform