Renaming Modules and Libraries


You can change the name of a module or library from the Macro Organizer dialog. Module names are changed from the Modules tab, and library names are changed from the Libraries tab. When you change a library or module name, it doesn't change anything that references the contained macros. For example, if I write down your telephone number in my Palm Pilot and you change your telephone number, my Palm Pilot is not automatically updated. So, what might call a macro?

  • When controls are embedded in a document or a dialog, they frequently use macros as event handlers.

  • Macros call dialogs that are contained in libraries.

  • Macros may be called from programs outside of OpenOffice.org.

Warning  

When you rename a module or a library, references to the contained macros are not updated.

Renaming a library or module isn't a bad thing to do; just remember that things that reference the modules and libraries won't be updated. If nothing is referencing your code, feel free to change the module and library names. You can rename libraries and modules by using the Macro Organizer; the procedure is the same for both:

  1. Find the library or module in the appropriate tab of the Macro Organizer (see Figure 16 and Figure 17).

  2. Select the library or module.

  3. Wait a moment and click on the library or module. The cursor should appear to edit the library or module name. I have found this to be a bit sensitive, and sometimes I must purposely single-click a few times. Do not accidentally double-click, because this opens the library or module contents for editing.

  4. Type a new name for the library or module and press the Enter key.

I had a large document that contained numerous buttons. The buttons called macros in a library and I had to change the name of the library. Unfortunately, after I changed the name of the library, the buttons still pointed to the original library, which no longer existed. Feeling particularly daring, I unzipped the document into a temporary directory (remember that an OOo document file is really a ZIP file containing numerous files that, as a whole, are the document). I then used my favorite text editor to load each file and I changed the old library name to the new library name. When I was finished, I zipped all of the files and directories back into a single ZIP file and I had successfully changed all of the references.

Warning  

Manually editing an OOo document file by unzipping all of the contained files and directories and then zipping them back is an error-prone process. If you do it wrong, the document will stop working. In other words, keep a copy of the original file.




OpenOffice.org Macros Explained
OpenOffice.org Macros Explained
ISBN: 1930919514
EAN: 2147483647
Year: 2004
Pages: 203

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net