Share via


Sharing Code using the Code Librarian

This content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release.

With the Code Librarian, you can view the code in the database and insert the code directly into one of your class modules.

  • Searching for Code in the Code Librarian

  • Inserting Code into your Project from the Code Librarian

To share code between multiple developers, place a Code Librarian database on a network share where each developer can access it. To view the code, each developer need only open the .mdb file.

Note   When you first start Code Librarian, you'll need to open the Codelib.mdb file to view all of the code snippets included with Office 2000 Developer. This database is located in Office 2000 Developer directory at ..\Microsoft Office\ODETools\V9\CodeLib.mdb.

You can also create additional database files to store code.

Searching for Code in the Code Librarian

Because the code snippets in the Code Librarian are annotated with keywords and organized by categories, there are three ways to find source code: contents listing, keywords, and full-text search.

Contents Listing

The Contents tab contains a list of the categories of available source code.

To find code using the Contents tab

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

  2. In the Contents window, click the desired category. The list of available source code snippets for the category is displayed in the Code box.

    ****Note   ****Click the plus sign next to the category name to expand the list of subcategories.

  3. In the Code box, select the desired code snippet to display the source code description and input/output parameters. Double-click the desired code item in the Code box to view the source code.

    ****Note   ****Right-click the code snippet for additional commands.

Keywords

The Keywords tab contains an index of keywords associated with all of the code in the library.

To find code using keywords

  1. In the Code Librarian, select the Keywords tab.

  2. Enter a keyword in the Type in the keyword to find box. The list scrolls to the nearest matching keyword.

  3. Double-click the keyword to view a list of all associated code snippets.

  4. Double-click the desired code item in the Code box to view the source code.

    ****Note   ****Right-click the code snippet for additional commands.

The Search tab contains a full-text search of the actual code (or just the titles) in the library.

To find code using full-text search

  1. In the Code Librarian, select the Search tab.

  2. Enter the text to search for in the Type in the word(s) to search for box.

  3. If desired, click the arrow next to the text box to choose from the Boolean operators AND, OR, and NOT.

  4. From the Search Options section, choose Search titles only or Search through code.

  5. Click Search. All code snippets meeting the search criteria are listed in the Code box.

  6. Double-click the desired code item in the Code box to view the source code.

    ****Note   ****Right-click the code snippet for additional commands.

Inserting Code into your Project from the Code Librarian

Once you have found the code snippet you wish to use, you can easily insert it in your code module by dragging it onto your code module or by copying the code to the Clipboard and pasting it into the code module.

To drag code from the Code Librarian into an existing code module

  1. In the Code Librarian, select the code snippet you wish to use.

  2. Double-click the code item to view the code.

  3. On the Code tab, select the code you wish to use.

  4. Using the mouse, drag the selected code from the Code tab to the location in your code module.

When you release the mouse, the selected code is inserted in the location.

To insert code from the Code Librarian into your module

  1. In your code module, place the cursor in the location where you want to insert the code.

  2. In the Code Librarian, select the code snippet you wish to use.

  3. Right-click the code item, and select Insert in Module.

    -or-

    Select the code item, and click the Insert Code to Module toolbar button.

The code from the Code Librarian is inserted in your code module.