Visual Basic Environment

The Visual Basic Environment (VBE) has undergone a complete facelift. Formerly not much more than an integrated notepad the new visual basic editor takes on the best features of both the MSDev editor in Visual C++ and the Visual Basic IDE and combines them into a new environment. This environment will be common to all applications hosting VBA 5.0 not just Microsoft Office97.

The Visual Basic Environment

The new IDE window is the most visible portion of the VBE. This MDI window is a window separate from the Office97 MDI window hosting it. This allows the developer to continue to view the application environment without altering it while stepping through code. At first this seems a little awkward to use but with a big enough screen it has some great advantages.

There are two new options for displaying windows in the VBE. Windows can be docked with any of the four sides of the VBE. Windows can also be linked together making a single window out of one or more floating windows.

Drag and drop is supported throughout the VBE. It is possible to drag a variable from the source window to the watch window to add a watch.

The VBE now has a project explorer similar to the project window in Visual Basic. The project explorer shows the components of the loaded projects in a tree view. Each project appears as a root in the tree. A project exists for each open document and template. The following project components are shown in the tree view:

Project Explorer

  • The document that owns the project
  • Sections internal to the document that can have code behind them
  • UserForms that belong to the project
  • Modules and Class Modules that belong to the project
  • References to other Office documents.

The project window provides for the import/export of all items in the project as well as the navigation of the project items.


Setting Properties

The VBE includes an improved property window over Visual Basic 4.0. The new property window allows for two views of properties, an alphabetic and a categorized view. The categorized view is also outlined and can be expanded or collapsed based on category.

Alphabetic Properties

Categorized Properties


VBE Object Model

The VBE now includes a full object model. References can be added and deleted from code that is not executing. Code modules can be manipulated, windows arranged, and projects manipulated. This is a great feature for developers who wish to write tools to make their development process simpler. No longer will we have to resort to SendKeys for some operations!


Enhanced Object Browser

Enhanced Object Browser

The Object Browser from Office95 has been improved so much it is hardly recognizable. The new object browser is a modeless window in the VBE. The window can be resized as well as minimized and maximized. Finally! The browser displays the classes on the left and the methods, properties, constants and events for the class on the left. When a member is selected a quick summary of it's calling convention as well as its parent object is shown in the bottom window. The parent object may be clicked on to navigate back up the object hierarchy. It is possible to search through the type libraries by typing into a combo drop down. A list of all matching members is shown and can be clicked on to view the prototype for the member. A history list is kept of all members that you browse and you can move forward and backward through the list similar to moving through pages in a web browser. While browsing through the type libraries it is possible to browse all of them at once or narrow the displayed classes to a single type library.

Enhanced Object Browser


Code Editor

The code editor is one area where quite a few productivity features were added. Many of the features are intended to help the beginning as well as the experienced developer. The beginning developer is given additional information in a non-intrusive way that the advanced developer can ignore. Almost all of these features are optional and can be turned off. Quick Info displays the syntax for a function, method, or procedure based on the cursor position. How many times have you forgotten all the arguments for the MessageBox function?

List Properties/Methods will bring up a listbox showing all valid items to complete a statement. This listbox will pop up each time you type a period as part of an object access. As you continue to type the listbox will attempt to select the item closes to what you have typed. When the selection is correct you can press Tab to complete the statement. Great for navigating long object hierarchies!

List Constants helps you remember the various options for a property. When you are doing a property set and type the equals sign after the property name a list of valid constants for that property will appear.

Word completion will complete a word when you have typed enough of the word to make it unambiguous to VBA. This is very similar to the list features but will work with any identifier.

Margin indicators are on the edge of all code windows. These indicators allow you to set breakpoints, set next statement, or set a bookmark. Bookmarks can be cycled through among code windows providing an easy way to navigate several sections of code you may be developing. Two views of the code are provided the traditional full module view from previous versions of VBA and now the procedure view from Visual Basic 3.0. Block indenting and undenting is now provided.


Debugging

Several new windows have been added in addition to the old Watch and Immediate window to make debugging much easier. The local window automatically displays variables that are in scope and near the currently executing line of code. In addition all module level variables for the currently executing module can be displayed. Arrays as well as objects may be expanded and collapsed to show their constituent members. Variables can be edited in place in any watch window.

Debugging Locals

Several new features have been added that affects the flow of execution. It is now possible to change the currently executing statement, to edit code while running without a reset occurring and to run to the selected line. When the cursor is placed over a variable in executing code and paused a Data Quick Tip will appear showing the value of this variable.


  Random Thoughts...
Diplomacy - the art of letting someone have your way.


Copyright© 1996-1999, Baarns Consulting Group, Inc. - All rights reserved.