OOo Basic macro for SaveAs

Creating a macro - Writing a Script - Using the API (OpenOffice Basic, Python, BeanShell, JavaScript)
Post Reply
th743xz
Posts: 2
Joined: Wed Apr 23, 2008 5:38 am

OOo Basic macro for SaveAs

Post by th743xz »

I am attempting to re-create in Win OOo Basic a VBA6 macro which emulates SaveAs. (Actually it's two almost identical macros, one for Excel and one for Word, but I'm hoping that the corresponding OOo Basic macro -- if it's possible to create it -- can serve for any type of OOo file.) The macro's functionality is as follows: A dialogue is brought up which states the path and name of the Excel/Word file containing the macro in a modifiable text box. (There are command buttons for all possible file letters and for toggling "Copy of" before the file name, but I assume this can be done easily in OOo Basic. I hope.) When the desired file path+name has been set up there is a "Save" button for saving the file with this name, and VBA6 provides a cautionary dialogue if the file exists already.

There are so many problems and questions about such a macro in OOo Basic that I don't know where to begin. For example, I've been unable to find a way to get the current OOo file's path+name. Also, even if the path+name can be got I can't find out any specific way to save the current OOo file by specifying its (possibly) new path+name in OOo Basic. Rather, it appears that SaveAs can be accessed but perhaps this just brings up the SaveAs dialogue without a default file name, just as in direct use of SaveAs in OOo. Does anyone have any experience that could bear on this problem?
User avatar
squenson
Volunteer
Posts: 1885
Joined: Wed Jan 30, 2008 9:21 pm
Location: Lausanne, Switzerland

Re: OOo Basic macro for SaveAs

Post by squenson »

I propose that you study a macro I developed for multiple back-ups. It is calling the SaveAs dialog box.
http://www.oooforum.org/forum/viewtopic.phtml?t=54881
LibreOffice 4.2.3.3. on Ubuntu 14.04
th743xz
Posts: 2
Joined: Wed Apr 23, 2008 5:38 am

Re: OOo Basic macro for SaveAs

Post by th743xz »

Thank you, squenson. Your macro looks to be very helpful.
Post Reply