Microsoft Office 2000 Developer   

Customizing Code in the Code Librarian

See Also

The Code Librarian uses a database format to store its code so you can easily update the existing information in the Code Librarian, or you can create a new code database.

Note   If you are accessing the Code Librarian database over a network, you may not have write privileges to that database. To make changes to a database, you must have the appropriate permissions.

Modifying Existing Code Databases

If you have write permissions to the Code Librarian database, you can make changes to the code snippets. For example, you can add new code, delete existing code, rename the code, add new keywords, and change the categories.

The Code Librarian comes with a database of commonly used code. This database is located in Office 2000 Developer directory at ..\Microsoft Office\ODETools\V9\CodeLib.mdb.

To change the information associated with a code snippet, select Modify from the Code menu.

Note   When adding new code, it is recommended that you include keywords and a description that will be helpful to others searching for code.

To add new code records

  1. In the Code Librarian, from the Code menu, select New.

  2. On the Code tab, enter a name for the new code snippet.

  3. Copy the source code into the Code box.

  4. On the Description tab, select a code type in the Specify the type box.

  5. Enter a description in the description box.

  6. On the Settings tab, insert the category and keyword information.

To delete code records

  1. In the Code Librarian, click the Contents tab.

  2. Right-click the code snippet, and select Delete.

Modifying Keywords

To associate new keywords with existing code records

  1. In the Code Librarian, right-click the code snippet, and select Modify.

  2. On the Settings tab, click the Add button in the Keywords area. This opens the Add Keyword dialog box.

  3. To add new keywords, click New, and type a new keyword in the Keyword box. This adds the new keyword to the list of available keywords.

  4. To associate a keyword in the list with the code snippet, select the keyword, and click Add.

  5. Click Close to return to the Settings tab.

The new keywords are now listed in the Keywords list.

To remove keywords from code snippets

  1. In the Code Librarian, right-click the code snippet, and select the Settings tab.

  2. In the Keywords area, select the keyword to delete, and click Remove.

Modifying Categories

Categories are used to organize code in the Contents tab. A code snippet can be stored under multiple categories.

To associate new categories with existing code records

  1. In the Code Librarian, right-click the code snippet, and select Modify.

  2. On the Settings tab, click the Add button in the Categories area. This opens the Add Category dialog box.

  3. To add new categories, click New. This opens the Code Librarian — New Categories dialog box.

  4. Type a new category in the Name box.

  5. In the Select where to place the category box, indicate where you would like the category to be. To create a subcategory, select an existing category. Select the top node to add the new category to the bottom of the list.

    This adds the new category to the list of available categories in the specified location.

  6. To associate a category in the list with the code snippet, select the category, and click Add.

  7. Click Close to return to the Settings tab.

The new categories are now listed in the Categories list.

To remove categories from code snippets

  1. In the Code Librarian, right-click the code snippet, and select the Settings tab.

  2. In the Categories area, select the categories to delete, and click Remove.

Creating a Code Database

You might be working on a project where the code requires a separate library of its own (in addition to the provided Codelib.mdb library). For example, maybe you're writing a programming book, and you want a good way to distribute your code. With the Code Librarian, you could package all of the source code with descriptions, keywords, and searchable text and titles.

To create a new code library database

  1. In the Code Librarian, from the File menu, select New.

  2. Enter a name for your new code library, and, if desired, browse to a new location to save the file.

    A new empty Code Library is created.

  3. Add your code snippets with descriptions and create categories and keywords. See the preceding procedures.