[VBA - Multiple Platforms] VBA Project Stopped Working - Possibly Due to Windows Update

We have a number of VBA Projects (and at least one compiled add-on for InRoads) that were tested for Ss10 and some even migrated to ORD CONNECT. Recently, our users reported that these were failing to work as before. The tools perform some of their functions, but others fail. To test my theory that a Windows Update may have broken these tools, I took advantage of the fact that my home PC is still running Windows 7 and therefore has not had any recent Windows updates.

At least one of these tools functions perfectly on my HOME PC, which does not seal the deal, but it does not eliminate it as a strong possibility.

Has anyone seen a similar occurrence on their systems and have any suggestions. Unfortunately, the programmer responsible for this tools creation is not available to assist us in fixing this. As for the compiled tool, our eventual migration Open Roads will eliminate its use, but we are far from there yet. But in a similar situation, we do not have a contract vehicle to get the tool fixed if it requires recompiling and/or code modifications.

Many of our tools have error logging built in, this is what it showed yesterday when I ran it. I suspect the later errors are related to one or more earlier errors where an expected object fails to get created. One issue that I notice that instead of the project name, the first error lists APC.ApcHost.6. I do not understand what that is and why. Notice the rest list the project name - LandXML. There does not appear to be any code using that text - APC.ApcHost.6.

09/09/2021 12:49:48 PM crheault SHAOHDPCE10722 [APC.ApcHost.6]clsSOTable - CreateBubbleLabel ERROR -2147467262: Index not found. The specified index or name does not exist in the collection.
09/09/2021 12:49:49 PM crheault SHAOHDPCE10722 [LandXML]clsSOTable - CreateBubbleLabel ERROR 430: Class does not support Automation or does not support expected interface

(Note that this last line repeats  21 X. See next paragraph to explain where the 21 times probably comes from.)

09/09/2021 12:49:51 PM crheault SHAOHDPCE10722 [LandXML]clsSOTable - FormatTable ERROR 91: Object variable or With block variable not set
09/09/2021 12:49:51 PM crheault SHAOHDPCE10722 [LandXML]clsSOTable - IPrimitiveCommandEvents_Dynamics ERROR 9: Subscript out of range
09/09/2021 12:49:51 PM crheault SHAOHDPCE10722 [LandXML]clsSOTable - FormatTable ERROR 91: Object variable or With block variable not set
09/09/2021 12:49:53 PM crheault SHAOHDPCE10722 [LandXML]clsSOTable - IPrimitiveCommandEvents_Dynamics ERROR 9: Subscript out of range
09/09/2021 12:49:53 PM crheault SHAOHDPCE10722 [LandXML]clsSOTable - FormatTable ERROR 91: Object variable or With block variable not set

This is supposed to place bubbles callouts on vertices of a shape and then create a table listing them in order with station, offset and coordinates. There were 21 vertices on the shape - the bubbles fail to get created, as does the table. it does create a list of the text for the table which allows it to be saved as a text file.

 
 

  • Much bigger problem (and often it's what requires 99% of time) is to understand dirty old spaghetti VBA code, written by non-programmers, to ensure new code will offer the same functionality

    Because of MicroStation's history, a worst-case situation exists.  Imagine when some code exists as user command macros (UCMs) and some as BASIC or VBA, and the macro calls the UCM using a key-in command.  UCMs are write-only code, don't work in CONNECT and reverse-engineering is difficult or impossible.

    To ensure new code will offer the same functionality .... and the code itself is often the only source of information, because no formal documentation exists

    A common problem is that, as in 's case, the code has evolved over decades, the original developer has left the organization and nobody thought to document the functionality of the app. while he was still around.

     
    Regards, Jon Summers
    LA Solutions

  • Hi ,

    As I was working on another issue, I see I accidently provided you an incorrect recommendation to debug using: VBEProjectsList (lists all modules in a project) that should have been VBEProjectReferences (lists all MVBA projects and respective References).

    HTH,
    Bob



  • HI Chuck,

    We operate mostly in ProjectWise, so the actual mvba's  get copied to each local PC and run.

    Even though it's probably not crucial for the discussed issue, it's important information.

    However, there may be other support files automatically supplied that are not part of the references, so its possible one or more of those are the cause of the problem.

    That's always a possibility ;-) but I don't think so.

    In MicroStation VBA, everything except mvba file itself has to be installed (VBA engine) and registered in Windows (referenced dll, ocx... libraries) and cannot be simply copied.

    I continue to hope someone has determined a fix that they applied and share that information.

    I do not think it's possible without detail analysis of affected PCs.

    APCHost message points to MicroStation + VBA installation, not mvba file. Did you try to reinstall (or repair) MicroStation installation? Or to try to use /regserver?

    Regards,

      Jan

  • I wanted to document everything I could. I worked out the syntax to list vb applications and their reference. I may see what else I can report on but I do plan on trying that approach. It's just there are a lot of modules and classes and forms to export.

    We operate mostly in ProjectWise, so the actual mvba's  get copied to each local PC and run. So the copy is always up to date. However, the references are always static to the individual PC's. What is on the PC is used. However, there may be other support files automatically supplied that are not part of the references, so its possible one or more of those are the cause of the problem.


    Charles (Chuck) Rheault
    CADD Manager

    MDOT State Highway Administration

    • MicroStation user since IGDS, InRoads user since TDP.
    • AutoCAD, Land Desktop and Civil 3D, off and on since 1996
  • I continue to hope someone has determined a fix that

    Did you try my suggestion to deflate your VBA projects?

     
    Regards, Jon Summers
    LA Solutions

  • Unfortunately, many of these tools are not used daily but only at certain milestone or as needed. So it is very difficult to nail down when they topped functioning.

    I continue to hope someone has determined a fix that they applied and share that information.

    If anything, being able to report on the References of each Project might help as I can than do a file by file comparison. I tried adding code to the VBAProject tool, but I am struggling with the syntax I can use. During a step into, I can look at the locals nd see them, but it would be more useful if I could get it to add them to the list it generates,

    At least the references are on the users PC in a standard location. Since we work in ProjectWise, the list of projects only shows files in the PW working directory.


    Charles (Chuck) Rheault
    CADD Manager

    MDOT State Highway Administration

    • MicroStation user since IGDS, InRoads user since TDP.
    • AutoCAD, Land Desktop and Civil 3D, off and on since 1996
  • Hi ,

    They all appear to be. None show as "Missing". I cannot read all of the paths as the dialog box is too narrow for some. So I may need to do some detective work. A comparison between my home PC and Office PC look to be identical.

    If you are having issues seeing a list of MicroStation VBA Projects (.MVBA) and respective Reference Details for each, feel free to use the VBEProjectsList() subroutine I posted. 

    Alternately, if you are permitted to install free 3rd party utilities; one I find invaluable is Search Everything (Download by VoidTools).  This tool permits you to search across a large numbers of all files on your system (e.g. I have over 8M files) producing immediate results for partial and wildcard pattern file/folder names. From those results you can sort by date/time (most recent), open path (an explorer window), Run As Admin (for .exe's) conveniently with fewer steps to perform.

    HTH,
    Bob



  • Hi ,

    Recently, our users reported that these were failing to work as before. The tools perform some of their functions, but others fail. To test my theory that a Windows Update may have broken these tools

    Open Windows Reliability History feature (Win + "Reli") and see if you can find evidence (by day or day before the event occurred) on both a good and bad machine if needed for comparing. This is a quick way to see most noticed and unnoticed software patches and upgrades along with being able to click on any Details present to find more detailed logs, crash/exception data, etc.

    HTH,
    Bob



  • It has 14 forms, 15 modules and 32 class modules!
    My experience with VBA is so bad that I never use it (and do not recommend as well) for anything more than simple macros

    Jan's comment may point to a solution.  I agree with him: on the couple of occasions when I have been obliged to work with a large VBA project the ability of VBA to self-destruct is astonishing. 

    a Windows Update may have broken these tools

    VBA is perfectly able to break itself without the help of a Windows update.

    Deflate your VBA Projects

    Microsoft itself has admitted that VBA projects are 'full of air'.  I have observed anomalies when a VBA project becomes confused about its identity.  Rebuild your projects to compress and reorganize them.

    You need to be rigorous in creating a file structure for the following steps, so files end up in the right place...

    1. Backup: Make a copy of all your VBA projects and put them somewhere safe
    2. For each of your VBA projects
      • Create a folder to contain the temporary files
      • Export each UserForm, Class and Module to a text file
    3. Create a new set of VBA projects with names similar to, but distinct from, your existing projects
    4. For of those new, empty, VBA projects
      • Import each saved UserForm, Class and Module from the text files

    What the above, admittedly tedious, process does is to enable VBA to recompile each project's contents.  It eliminates spurious problems, such as the one you report, and leaves you with a clean sheet.

     
    Regards, Jon Summers
    LA Solutions

  • They all appear to be. None show as "Missing".

    When there is nothing displayed as red, everything is fine.

    Searching Google for APC.ApcHost.6 has not really been fruitful either.

    I did some more search also and the situation is bit more clear now:

    APC (Application Programmability Component) is the interface Microsoft provides 3rd party vendors (like Bentley) to interface with the Microsoft VBA engine to provide event handling and extensions to the "common" Microsoft COM VBA APIs.

    Based on this information, I recommend to to try to start MicroStation (or other product) using Administrator rights (e.g. to open command prompt "As administrator") in this way:

    ustation.exe /RegServer

    ... but it "refresh" the connection between MicroStation and VBA engine only, so when the problem is in corrupted VBA engine itself, it probably does not help.

    We are going to reinstall the programs on a test PC and see if that fixes it.

    If the problem is in VBA engine issue, to reinstall MicroStation Prerequisite pack should be enough.

    It has 14 forms, 15 modules and 32 class modules! 

    That is not small for VBA (because VBA has no tool for code management), but that's tiny application in context of general software development.

    The problem comes when either something stops working or a new version requires code revisions.

    I understand. And it's where VBA always fails, typically in some disastrous way, because VBA does not allow to use any code management tool (like Git), so it's impossible to compare version, so quick testing etc.

    But to do this in the middle of our Migration to the CONNECT platform is far from ideal as well.

    Yes, the migration to CONNECT Edition is a big challenge.

    My experience is (fortunately) I was able to negotiate with all customers to migrate their VBA macros to C#. In general, to swap from VBA to C# is simple. Much bigger problem (and often it's what requires 99% of time) is to understand dirty old spaghetti VBA code, written by non-programmers, to ensure new code will offer the same functionality .... and the code itself is often the only source of information, because no formal documentation exists ;-)

    Regards,

      Jan