SaveAs(FileName,FileFormat) doesn't work

I’m trying to save some exceldata in SKV-format. But the SaveAs method fails, seems like it won’t accept more than one parameter. If I omit the second parameter, the code works fine. Anyone out there who know’s something about this ? ---------------------------------------- CLEAR(xlApp); CREATE(xlApp); xlApp.Workbooks.Open(‘c:\test.xls’); xlBook := xlApp.ActiveWorkbook; FileFormat := 64; //SKV xlBook.SaveAs(‘c:\xxx’,FileFormat); /Error: SaveAs-method failed xlBook.close; CLEAR(xlApp); ----------------------------------------

What exactly is the error message? The docs say that “some file formats may not be available, depending on your localized version”. E.g. here in my German version of Excel, I don’t have FileFormat 64 defined. Did you try other formats, like CSV or HTML? Did they give an error too?

Thanks Heinz Something’s funny about property FileFormat.The code below works fine when converting from skv to xls. Maybe my Fileformat is wrong for skv. It’s declared as integer. Any idea of how to get the correct value for fileformat skv ? ---------------------------------------------------------- CLEAR(xlApp); CREATE(xlApp); xlApp.Workbooks.Open(‘c:\test.skv’); xlBook := xlApp.ActiveWorkbook; FileFormat:=xlBook.FileFormat; MESSAGE(’%1’,FileFormat); // message print skv Fileformat 64 // message print xls Fileformat -4143 FileFormat := -4143; xlBook.SaveAs(‘c:\xxx’,FileFormat); xlBook.Close; CLEAR(xlApp); ----------------------------------------------------------

“Exact” errormessage, translated from Swedish ------------------------------------- This message is for C/AL programmers: The call to member SaveAs failed. Microsoft Ecel returned the following message: SaveAs-method in Workbook-class failed OK -------------------------------------

I must admit that I don’t have the slightest idea what the SKV format is [:p] First off, your method to find out the correct integer value for SKV is fine - you could also fire up VBA inside Excel, open the object catalog (F2), and look up the XlFileFormat enumeration. By clicking on (I assume) xlSKV, you can see the internal integer representation. It should be the same value (64) that you got from the property. Second, when saving an Excel file (.xls) as, say, a CSV file, Excel usually prompts you that some formats etc. can only be saved in native XLS format and will be lost in CSV. Could it be that the same happens when saving to SKV? If so, there should be some kind of override or “silent” option that needs to be activated before the Save. Did you try the SaveAs in Excel? Did it work?

Thanks again Heinz, this solved the problem. There seems to be some discrepancy between the list of xlFileFormats in VBA and the list in the Excel user interface in “Save as”. If I select a format that exists in both lists the code works fine, otherwise not. Besides: SKV shows uo to be the same as xlCSV, format 6. Apparantly some of us need to dig deeper into VBA [:)]

O wonderful details of Microsoft products [:p] Is SKV Swedish for “Comma Separated Values”?

Yes, the “Save as”-menu print: SKV (semicolon separared) (*.skv)