50.3 Connecting to the Object Interface via Object Libraries

Scripting languages communicate with TreeAge Pro via Java Remote Method Invocation (RMI). When TreeAge Pro starts up it starts a service on port 1099 which listens for RMI requests.

The non-Java objects are instantiated via the library TreeAgeProOI. This library must be referenced for your code to access the TreeAge Pro Object Interface objects. Below is a picture of the library objects as seen from the Excel Visual Basic Editor's Object Browser.

You can use these library objects to open, modify and analyze trees within Excel or other programming environments. Even when not working in Java, refer to the Java API documentation for object/method syntax.

Since the library is registered on the computer, there are no requirements for a build environment as there are for Java projects. You can save the code anywhere on your computer or network.

Sample Visual Basic code

Sample Visual Basic (VB) code is provided in the Excel document "Use Object Interface.xls" in the TreeAge Pro Interface tutorial examples project. See below.

The UseObjectInterface.xlsm document contains sample VB code that opens, edits and analyzes sample trees. You can use this file as a starting point for creating your own VB source code.

If you choose to create your own source code using this example, be sure to save the file using a different filename in a different location. Otherwise, your source could be overwritten if an updated version of the example code is released.

This section will introduce you to the sample VB code. However, the VB code itself contains comments that serve as the primary documentation.

To see the VB code in Excel 2007 or later:

  • Click on the Office button and then click the Excel Options button.

  • In the Popular category, make sure the Show Developer tab in the ribbon box is checked.

  • Select the Developer tab in the ribbon.

  • Click the Visual Basic button.

To see the VB code in Excel 2003 or earlier:

  • Choose Tools > Macros > Visual Basic Editor from the menu.

The VB code has a primary macro called TestObjectInterface, which contains the main processing steps. Additional methods provide the details on opening, modifying and analyzing trees.