<p class="Head1"><help:link Id="66501">Creating and Organizing Libraries and Modules</help:link></p>
<p class="Paragraph">The following provides an introduction to working with libraries and modules. You will discover how to create and delete libraries and modules, and how to move OpenOffice.org Basic projects between documents, templates or the application.</p>
<p class="TextInTable">Generally, each OpenOffice.org Basic project should be stored in an individual module.</p>
</span></th></tr></table>
<p class="Paragraph"/>
<p class="Head2">Organizing Libraries</p>
<p class="Head3">Creating a New Library</p>
<ul class="L1">
<li class="">
<p class="P2">If you are not in the IDE, first select the <span class="T1">Macro</span> command in the <span class="T1">Tools</span> menu, and click <span class="T1">Organizer</span> in the dialog that follows.</p>
</li>
<li class="">
<p class="P2">If you are already in the IDE, click the <span class="T1">Modules</span> icon to open the corresponding dialog.</p>
</li>
<li class="">
<p class="P2">Click the <span class="T1">Library</span> tab.</p>
<p class="P3">In the <span class="T1">Library</span> drop-down list box, you can select the object you want to attach the library to. This can either be the OpenOffice.org program itself or any open document or template.</p>
</li>
<li class="">
<p class="P3">Click the button <span class="T1">New</span>, and OpenOffice.org Basic creates a new library.</p>
</li>
</ul>
<p class="Head3">Renaming a Library</p>
<ul class="L3">
<li class="">
<p class="P4">To change the default name of a library, proceed as follows:</p>
</li>
<li class="">
<p class="P4">Right-click the name of the library.</p>
</li>
<li class="">
<p class="P4">The cursor appears at the end of the name, indicating that you can now edit the name. Press Enter to confirm your changes.</p>
</li>
</ul>
<p class="Head3">How to Define whether to Load a Library</p>
<p class="Paragraph">If you have several libraries attached to a document or library, or as is frequently the case, to the application itself, it may be especially difficult to maintain an overview of the existing modules. For this reason, OpenOffice.org Basic allows you to hide or show each library by selecting the corresponding check box. If you deselect a library, it will be deleted from the working memory. Basically, only the libraries selected via the check box are available to you.</p>
<p class="Head3">Deleting a Library</p>
<ul class="L4">
<li class="">
<p class="P5">In the <span class="T1">Library</span> drop-down list box, select the object to which the library to be deleted is attached. This can either be the OpenOffice.org program itself or any open document or template.</p>
<p class="TextInTable">Note: As soon as you delete a module, all contained SUBS and FUNCTIONS are permanently deleted.</p>
</span></th></tr></table>
<p class="Paragraph"/>
<ul class="L8">
<li class="">
<p class="P9">Click the <span class="T1">Delete</span> button and confirm the dialog that follows with "Yes".</p>
</li>
</ul>
<p class="Head2">Organizing Projects among Documents or Templates</p>
<p class="Paragraph">Once you have developed a program or program project with OpenOffice.org Basic, you may wish to move specific parts of a program, or the entire macro project, to other documents or templates.</p>
<p class="TextInTable">Note that a OpenOffice.org Basic program generally consists of more than one macro - i.e., multiple SUBS. Therefore, if you have developed a program with multiple SUBS and FUNCTIONS that call each other, make sure you copy all necessary elements in order for your program to run in another document or template.</p>
</span></th></tr></table>
<p class="Paragraph"/>
<p class="Head3">Moving or copying modules, dialogs or libraries between documents, templates and the application.</p>
<ul class="L9">
<li class="">
<p class="P10">First, open all documents or templates among which you want to move the various objects (modules, libraries, dialogs).</p>
</li>
<li class="">
<p class="P10">Select the <span class="T1">Macro</span> command in the <span class="T1">Tools</span> menu, and click <span class="T1">Organizer</span> in the dialog that follows.</p>
</li>
<li class="">
<p class="P10">To move an object to another document or application, simply click the object and drag it to the desired position. A horizontal line indicates between which objects the moved object will be positioned.</p>
</li>
</ul>
<p class="Paragraph">To copy an object, proceed in the same manner, but keep the <help:switch select="System" xmlns:help="http://openoffice.org/2000/help"><help:case select="MAC">(Option)</help:case><help:default>(Ctrl)</help:default></help:switch> key pressed while you drag the object to its new position.</p>
<p class="Head3">Inserting a Library from another OpenOffice.orgProgram</p>
<p class="Paragraph">Libraries are created in every OpenOffice.org application. As soon as a library is saved, it exists as a file. You can then insert these library files into your project.</p>
<ul class="L10">
<li class="">
<p class="P11">Select the <span class="T1">Macro</span> command in the <span class="T1">Tools</span> menu, and click <span class="T1">Organizer</span> in the dialog that follows.</p>
</li>
</ul>
<p class="Paragraph">Click <span class="T1">Append</span> and select the file you want to insert.</p>