Save as Word doc

Is there a way that I can add “Save as Word docx” to my Writer toolbar in the same way I can add an “Export to PDF” icon?

There is no such icon available in the Customize menu (Tools > Customize > Toolbars). It might be possible to write a macro to do this, but I don’t know for sure.

Depending on how you intend to use it, adding “Save As” or “Export” to the toolbar might get you half way.

Here is a macro that I use to export from Writer/Calc/Impress to Microsoft’s X-d formats. I don’t remember who is the author of the original code, I just modified it. Warning: it fails on spreadsheet and presentation files (I am not skilled enough to understand the problem). However, it does export from Writer to DOCX.

Thanks so much, gabix. I’ve not used macros before but gave it a try! When I try to run it I get a popup box that says “BASIC runtime error. Argument is not optional.”
Now, I’m not sure if it has anything to do with it but I wasn’t sure what to do with the second section of code headed by “RAW Paste Data”.
BTW I’m using a Mac and I’m running LibreOffice v6.1.2.1.
Cheers

Paste the code from that RAW paste data section because the fancy colored code may contain some markup artifacts causing the error. And repost it as a comment because it is not an answer.

Please excuse my ignorance but where do I paste this code? At the end of the other code?

https://forum.openoffice.org/en/forum/viewtopic.php?f=74&t=5519