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 Be Communities.
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.
Imagine that we have this scenario, where
MS_CELL is pointing to …
but the actual directory name is this …
It's not that easy to spot that the final s is omitted from
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.
MS_DEF might expand to something like
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 …
vba run [ConfigVerifier]modMain.Main