I’m not sure how to search for an answer to this, so any help is appreciated.
My workflow involves saving not only the .xlsx version of a file, but also saving it as a csv (tab separated) version.
When I want to save a copy as csv I currently have to do this:
- click button to “save copy”
- change file type to “csv”
- click “yes” to confirm saving over existing file
- choose the options for exporting (which never change from save to save)
- click “OK” to acknowledge that only the active sheet was saved.
I have used the macro recorder to try to record all these steps. What I want is to be able to run the macro and have all of these things happen without any interaction by me.
However, when I run the macro, the only thing it seems to to is open the save copy dialogue. Here is the text of the macro:
REM ***** BASIC *****
Sub Main
End Sub
sub saveAsCsv
rem ----------------------------------------------------------------------
rem define variables
dim document as object
dim dispatcher as object
rem ----------------------------------------------------------------------
rem get access to the document
document = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
rem ----------------------------------------------------------------------
dispatcher.executeDispatch(document, ".uno:SaveACopy", "", 0, Array())
end sub
I’m really lost with this. I’m happy to learn more (I can do basic javascript things but this seems like maybe visual basic?). If someone could point me in the right direction, or even better tell me if what I want to do is even possible, I would greatly appreciate it.