If you find yourself constantly losing track of your VB or VBA code, you may want to try out Total Visual SourceBook from FMS. In addition to great cataloging features, it offers a large library of code modules and snippets that you can insert into your projects.
Integration and team code
Total Visual SourceBook will run as a stand-alone tool or as an add-in to the Visual Basic IDE or the VBA editor within Office 2000 or Office XP. It will also insert code directly into your projects, as we'll see shortly. You can put the Total Visual SourceBook database files on a network and give all your team members access to them. They can share the source code library and access it at the same time. This is a huge advantage, since everyone can get at the code that anyone else puts in the system.
In addition, a feature called Source Code Exchange (SCE) enables you to export parts of the database and send them to someone else who's using Total Visual SourceBook, such as an off-site developer or a vendor. This SCE file contains information about the code and its location in the database. When imported into the other database, Total Visual SourceBook will examine the code in the database and the SCE file to see whether there are any conflicts. If so, it will ask how to resolve them (replace, append, etc.). This is a great way to keep databases in sync for large or distributed projects.
Nice interface and storage
One of the things I like the best about the tool is the way it stores the code I put into the system. Its hierarchical structure goes like this:
Figure A shows how this works in the library of provided code.
|Provided code library|
The book icons are topics. In the code library, topics cover things like XML, Word, and Database Connectivity. The example in Figure A shows the expansion of the VBA topic.
The file folder icons represent categories. I've expanded the Registry category to show the classes and modules within it. You can see the CProgramSettings class and the modRegistry module expanded to show their members and procedures. Using this navigation method, it's easy to find the individual chunks of code you're looking for within the larger context of the module or class. Some other products I looked at held code only at the module level. To find a particular procedure, you had to dig through the code.
The other thing l like about the interface is the way it displays each item. It gives you a tabbed interface for viewing information about each item in the tree, as shown in Figure B.
For each module/class or member/procedure item, the tree view lets you store the code (obviously), add or view notes about the code, see an example relating to the item, and view details, which include dependencies between this item and other items. Clicking on a procedure in the tree shows just the procedure's code and notes. Clicking on a module in the tree shows the code and notes for the entire module. This aggregation of the code in the views using the module’s hierarchical children makes viewing the code and finding individual code items much easier.
Customizing the interface
The tool allows you to define color-coding standards for your collection of code. Figure C shows the Options dialog box. From here, you can control how Total Visual SourceBook will format and color code the modules in the library. Changing the settings here changes all the code in the library.
|Options dialog box|
Total Visual SourceBook's importation feature is also well done. If you import a .bas file that contains a module or class, it will automatically find the declarations, members, or procedures and create the right entries in the database. For instance, if you import a module that contains seven procedures for working with tasks, you'll get something like Figure D.
|Seven procedures for tasks imported into a database|
The search is on
Once your code is in one place, you’ll need to find the right procedure. Total Visual SourceBook has a great Search dialog box (Figure E). It allows you to perform complex searches based on dates, on who created or modified the code, or on where the search string is located (Description, Code, or Example). It will also let you limit your search to certain code categories.
After you pick your search criteria and conduct a search, your query results will be listed in the Results pane at the bottom of the screen, as shown in Figure F. Selecting one of these results will show you the code for that listing.
|You can easily thumb through the search results.|
Using the code
Here's the important part: How do you get the code from the SourceBook tool into your project? There are several ways, and they all seem to work great.
First, you can right-click on any module or procedure entry in the tree view and select Copy. This puts the contents of that node of the tree onto the Clipboard. You can then paste it wherever you need it. Or you can use the Export feature (also on the right-click context menu). This lets you place the code on the Clipboard and export it to a file (.bas, .cls, or .txt) or right into Notepad. If you opened SourceBook as an add-in to a VB or VBA environment, it will allow you to insert the code directly into your VB or VBA project. Figure G shows this dialog box.
|The Insert Code dialog box|
This dialog box lets you create the code as a new module or append it to an existing object. It asks where the code should be saved and lists the projects that are open. This saves you the time of having to create a place in your project to place the code. SourceBook will create the new module for you or insert the code at the end of the specified module.
A single seat for Total Visual SourceBook costs $399, but there are significant savings for a five-user pack, which sells for $1,299, and an almost 50 percent reduction for a 20-user pack at $3,999.
You can also get Total Visual SourceBook as a part of a bundle of FMS’ other products. You'll find licensing and bundling information at the company's site.
One small heads-up
Total Visual SourceBook is completely different from Microsoft Visual SourceSafe. While Visual SourceSafe provides version control and prevents developers from checking out the same version of the code simultaneously, Total Visual SourceBook is a source code library. It facilitates the sharing of finished code and makes it easy to document and find code for reuse.
Try it out
Total Visual SourceBook has saved me hours because I don’t have to hunt for older code snippets and am able to employ its vast code library. Total Visual SourceBook can help VB developers keep better track of their code without blowing their budgets.