asp.netPRO Magazine



Subscriptions
Subscribe
Trial Offer
Renew Subscription
Change of Address
Pay An Invoice

Microsoft
Smart Solutions
Features
Book Reviews
Product Reviews
New Products
Case Studies
Solutions
News
Opinion
Forums
Search

Downloads
Premium Downloads
Third-party Tools
Upload A File


Informant
Media Kit (PDF)
Contact Us


Click here for trial issue

Share your Office/VBA tip, get a FREE T-shirt!



 •

Get Productive


 •

Hybrid Vigor


 •

No App Is an Island


 •

Connecting with Word


 •

PowerPoint Pizzazz





Tell a friend
about this article!




Product Review

Object Model Browser 2

An Object Browser Replacement from Roman Press

Don't judge this program by its appearance. For US$69.95, you'll receive a CD-ROM that looks homemade, with a laser-printed label and documentation straight from a copier. You can't help but picture the product's developer, Steven Roman, building the packages one at a time in his home office. But don't let the unassuming packaging fool you. This is a sweet little utility that will quickly replace the built-in VBE Object Browser as your tool of choice for examining the object structures.

The Wizard Layout

The Object Model Browser (now in version 2) performs the same basic functions as the VBE's built-in Object Browser (displayed by pressing [F2] in the VBE), but with several important additional features. First is its ability to document virtually any library. This is done through its Create Model Wizard (see FIGURE 1).


FIGURE 1: The Create Model Wizard.

Object Model Browser allows you to search for libraries by browsing for files that have an .exe or .dll extension, searching a drive for files with an .olb or .tlb extension, or reading the Windows registry for a list of installed type libraries. A data file is then generated containing all the information needed to build the model. Even for a model as complex as Word 9.0 (as used in FIGURE 1), the process is quick. Previously generated data files can also be loaded from the Library tab of the Create Model Wizard.

The Create Model Wizard then walks you through the process of building a customized, hierarchal model of the objects within the library. On the Model tab of the Wizard, the model is named and can be assigned to an existing or user-defined category. This allows for easy organization once several models are in use.

Next, the top object of the hierarchy is defined. In the example shown, the Application object is recognized as the built-in top object of Word 9. Some libraries, however, have more than one top object. This page allows you to create a custom top object, and place the other top objects underneath it (see FIGURE 2).


FIGURE 2: The Top tab allows you to create a custom top object.

On the Special tab, other options are available or disabled, depending on the structure of the library. These options allow the Wizard to create nodes for events, controls, or a global object, as needed.

The Ext Edges tab of the Create Model Wizard allows external edges to be included in the model (see FIGURE 3). External edges, according to the instructions that appear at the top of the wizard, are "edges that end in an object belonging to another object library." In this case, the connections to the Office and VBE libraries are shown, because Word interacts with those libraries.


FIGURE 3: Including external edges in your model.

In the next step, the Wizard offers you the chance to add custom objects to the model. This might be handy for incorporating objects from a custom add-in to the model of an Office application, for example.

The Collection tab shows collections and their members (see FIGURE 4). A collection can be documented as a non-collection by changing its Collection property to No in this window, or a non-collection object can be shown as a Collection by changing this property to Yes. In the latter case, a dialog box asks for the name of the member as it should appear on the diagram. The new collection is shown in FIGURE 5. It was safe to play around with this because the option is provided to reset any or all values to their originals.


FIGURE 4: A view of the Collection tab, which shows collections and their members.


FIGURE 5: The new collection you've created.

On the final tab of the wizard, you can add edges to the diagram. The instructions explain: "The upper list shows functions with return type Object or Variant. These functions WOULD contribute edges to the model IF their return types were not generic. Hence, you may want to create some edges to compensate."

Once all options have been set, clicking the Make Model button generates the hierarchical model (see FIGURE 6). Again, this is very fast. (On my fairly standard Pentium II, it took less than 10 seconds to draw an object model for Word 2000.) Once the model is created, it can be saved for future use, and loaded without the need to use the wizard again.


FIGURE 6: A view of the hierarchical model.

Making Life Easier

Now the Object Model Browser really begins to make life easier. First of all, the view can be set to either Global or Local, showing the full model or just the selected branch. Next, the searching capabilities are far superior to the VBE's Object Browser. Because most of us don't browse the object model for fun, but rather pull it up to find a specific object or path, this capability will save a lot of time hunting for the appropriate section of the model.

Visually, the browser is much more informative than the standard Object Browser. Not only is the tree-view more representative of the hierarchical relationships among the objects, but each node has an icon to indicate its specific nature. A pop-up legend is available through the Help menu that shows the meaning of each icon. If a Help file and context ID are associated with the object, right-clicking on the node will open Help in the proper context location. For further information, there are views showing just the constants, or a list of creatable objects, hidden objects, and other statistics.

Just as I'd seen enough to be glad I wasn't stuck with the old browser, I was surprised again. Because I do a lot of Word automation from Access, I often need to determine the nature of the Word document I'm working with in my VBA code. Recently, I needed to determine if a particular document was a mail merge document. It was easy enough to read the State property of the document, but interpreting the resulting number required digging into the constants to find out what state each number represented.

I loaded the Object Model Browser and looked at the MailMerge node. Clicking on the State property displayed in the top window that I was looking for a constant of type wdMailMergeState (see FIGURE 7).


FIGURE 7: Getting the information you're looking for.

Then I asked for the Enums window, and found the values for all of the constants of that type. I clicked on Options and selected Copy Enum/Constant to Clipboard. The result was a neat bit of commented code:

' Enum WdMailMergeState

   ' wdNormalDocument = 0

   ' wdMainDocumentOnly = 1

   ' wdMainAndDataSource = 2

   ' wdMainAndHeader = 3

   ' wdMainAndSourceAndHeader = 4

   ' wdDataSource = 5

' End Enum

Then I clicked on the menu to Create Enum Select Code. A window opened containing a function that would return the text value of each of the integer values possible for the property. I appreciate that the tool gave me a choice to just "comment out" the code for clarity, or to actually use the function to return a string, both without any typing on my part.

Conclusion

Those who will appreciate this tool are the serious VB and VBA developers who don't care that CD-ROM is silk-screened, as long as the program helps get the work done. Object Model Browser 2 does just that. Because it lacks the fancy packaging and interface of a product intended for wide commercial release, you get the feeling that Steven Roman built this tool to make his own work easier, then decided to share it with the rest of us. You'll be glad he did.

Lisa Z. Morgan is a Systems Analyst for the Mid-Atlantic Agency Division of Lawyers Title Insurance Corporation, where her primary purpose is to make Microsoft Office obey management's every whim. She also does freelance Office programming as owner of Lairhaven Enterprises. Lisa can be reached by e-mail at mailto:zacksmom@pinn.net.

MOD Fact File

Don't judge the software by its cover. Object Model Browser (version 2) is a sweet little utility that will quickly replace the built-in VBE Object Browser as the tool of choice for examining the object structure of any library. This is a tool that a serious developer built to make his own life easier, then decided to share with the rest of us. You'll be glad he did.

 

Roman Press

E-Mail: mailto:sroman@fullerton.edu

Web Site: http://www.romanpress.com/

Price: US$69.95

Microsoft Internet Explorer
Top of page

asp.netPRO Magazine

Informant Communications Group

Informant Communications Group, Inc.
10519 E. Stockton Blvd., Suite 100
Elk Grove, CA 95624-9703
Phone: (916) 686-6610 • Fax: (916) 686-8497

Copyright © 2002 Informant Communications Group. All Rights Reserved. • Site Use Agreement • Send feedback to the Webmaster • Important information about privacy