Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Load Excel template
Message
De
09/06/2005 13:22:50
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Divers
Thread ID:
01021794
Message ID:
01021873
Vues:
29
>>>>They have different extensions and since the SaveAs() method is invoked instead of Save(), the extension will be qualified by excel - I think.
>>>
>>>I think, if you don't specify a type with additional parameter in SaveAs, it'll be saved as is w/o converting to XLS. IOW, specifying XLS extension doesn't convert open document to XLS type.
>>
>>Hmm. Not sure about this. It did save the file as a regular excel file.
>
>Here's a code that opens CSV file (created by COPY TO CSV ... in VFP) in EXCEL and then saves it with XLS extension. If you open XLS file you'll see that it still CSV (text) file.
lcCsvFile = "H:\temp\test.csv"
>lcExcelName = FORCEEXT(lcCsvFile, "XLS")
>oExcel = CreateObject("Excel.Application")
>oExcel.Visible = .T.
>oExcel.DisplayAlerts = .F.
>oWorkbook = oExcel.Workbooks.Open(lcCsvFile)
>IF FILE(lcExcelName)
>	ERASE (lcExcelName)
>ENDIF	
>*xlExcel5 =	39
>*oWorkbook.SaveAs(lcExcelName,xlExcel5)
>oWorkbook.SaveAs(lcExcelName)
>oExcel.Quit()
>Modify command (lcExcelName) NOWAIT
>
I don't know if it's applicable to XLT->XLS, though.

Then I agree that you are right. The Help file states the behavior your pointing out as being the case.
"For an existing file, the default format is the last file format specified; for a new file, the default is the format of the version of Excel being used."

This begs the question: What is the xlFileFormat for Excel 2003?
ramil
~~ learning to stand still
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform