Hello there!
I’m trying to save a Sheets data in CSV file, but i wanna do it with a macro. I need the macro to be able to save the info as CSV automatcally in the same location where the document is, i wanna do it without openning any extra tab or screen, just save it. I want to use it as a data base, where the CSV file will always have the same name and will always be overwrited by the new one (that will have new data probably)…
In addition, i will only have the native functions of the program, can not use any outside adds to make it work…
Im very new in this language and do not know a lot.
Hope someone can help me.
Thankyou allready!
I found the cod bellow in a other topic around… the code does exactly what i need, but it requires the user to choose a local to save the file and a name to the file…
I need it to save with a defined name in a defined local…
Sub DDICSVsave
dim aUrl(), s$
dim oDlg as variant
dim fileProps(1) as new com.sun.star.beans.PropertyValue
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"
oDlg = createUnoService("com.sun.star.ui.dialogs.FilePicker")
dim listAny(0) as variant
listAny(0) = com.sun.star.ui.dialogs.TemplateDescription.FILESAVE_SIMPLE
oDlg.initialize(listAny()) ' Speichern unter
oDlg.setMultiSelectionMode(false)
oDlg.execute
aUrl = oDlg.getFiles()
thisComponent.storeAsURL(aURL(0), fileProps())
End Sub