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


* Select the whole code (note that there is a SELECT ALL button in the code section header that will do it for you)

* Copy that selection to the clipboard (CTRL+C)

* In OOo, go to Tools>Macros>Organize Macros>OpenOffice.org Basic

* Expand My Macros>Standard (or better: create a custom one, see post below*) and select the Module1 sheet, then the Main entry and hit Edit button

* Select All the default entries (CTRL+A)

* Paste the clipboard (CTRL+V)

* (You can rename the Module1 to have a better name)