Introduction

This article is written for an audience of Visual Basic for Applications (VBA) programmers. Specifically, VBA programmers wanting to write code for Bentley Systems MicroStation® VBA.

Questions similar to this appear on the Bentley Discussion Groups.

Q MicroStation® can't find the XXX file indicated by configuration variable YYY. How do I fix this?

A MicroStation uses configuration variables (CfgVars) to find files and folders. You can redefine CfgVars for your own purposes. A CfgVar may point to a file, folder, or a set of folders. When MicroStation starts up it processes its configuration files to define its set of CfgVars. There are tools mentioned here to help analyse a given configuration.

However, the tools provided with MicroStation don't solve every problem. They tell what CfgVars are defined, and provide the fully-expanded value of each one. What they don't tell you is whether a particular CfgVar is valid. Suppose a CfgVar points to some folder, but that folder does not exist: the debug tools don't reveal that problem.

Here are a couple of ways to validate CfgVars. If you are proficient with MicroStation VBA, then you can use a VBA solution. Alternatively, FlexiTable is a commercial off-the-shelf add-in for MicroStation.

FlexiTable

FlexiTable™ is a licensed product that can extract a variety of data from MicroStation. FlexiTable can create a worksheet of configuration variables and their values. It checks the validity of files or file paths specified by each configuration variable, and highlights those that don't point to a valid object.

Read more about FlexiTable here.

VBA Solution

Imagine that we have this scenario, where MS_CELL is pointing to …

V:\Projects\Workspace\Standards\cells\

but the actual directory name is this …

V:\Projects\Workspace\Standards\cell\

It's not that easy to spot that the final s is omitted from cell.

The Configuration Validator helps, by verifying the existence of the folder, folders or file to which a CfgVar points. The Configuration Validator is a MicroStation VBA project. When started, it pops a dialog that lets you enter the name of a CfgVar. It evaluates the CfgVar and shows you its expanded value.

For example, MS_DEF might expand to something like V:\Projects\Project1\dgn\. The Validate button tests that expanded value. In this case, if the folder exists you will see an appropriate message. But, if the folder doesn't exist, you will see an alert box.

Here's an example of a valid CfgVar …

And here's an example of an invalid CfgVar …

Download the Configuration Validator

You can download the Configuration Validator MVBA project.