calc: open and save csv-file with given filter options [closed]
I want to open (and save) CSV-Files in CALC with given filter settings (encoding, delimiter, quoting, etc.). It seems, that a macro could do the job and I found one for opening the file:
Sub importCSV(sURL$,sFilterOptions$)
dim fileProps(1) as new com.sun.star.beans.PropertyValue
' sets the imported file properties
fileProps(0).Name = "FilterName"
fileProps(0).Value = "Text - txt - csv (StarCalc)"
fileProps(1).Name = "FilterOptions"
fileProps(1).Value = "44,34,76,1,,0,false,true,true,false"
StarDesktop.loadComponentFromURL(sURL, "_blank", 0,fileProps())
End sub
Unfortunately I receive an error, when executing this macro ("BASIC runtime error. Argument is not optional.") with LibreOffice 4.3.04. There seems to be a problem with the line "StarDesktop...".
If opening works, is there an solution how to save the active sheet with the same options using a macro to "configure" the file save dialog?