Oct 21 2021 01:41 AM
Oct 21 2021 01:41 AM
I use Excel and Word to interface to lab test equipment (oscilloscope) using visacomlib DLL from Agilent/Keysight and VBA.
Recently (Oct 2021) Excel is crashing when I try to connect the scope (or any equipment on my GPIB bus).
Set SCOPE1.Command.IO = io_mgr.Open("GPIB:: 12")
My code is ok as it has always worked before.
Similar code in Word is working fine --> hardware interface and VISA drivers are ok.
Looking at the bus data using Agilent Connection Expert IO Monitor I can see the the connection to the equipment is being made but Excel crashes - monitor file attached.
Has Excel been changed recently that affect external DLLs?
Nov 23 2021 12:31 PM - edited Nov 23 2021 12:32 PM
I'm a support engineer at Keysight for the IO Libraries Suite software and do see this crash occurring in MS Excel and VBA as well after our IT team push out a MS Office update on Nov 17th 2021.
I recorded a video of going through the VBA program that uses VISA-COM Library in Debug mode and the loading of the library, initialization of the Resource Manager, opening the instrument session, executing SCPI commands and closing of the instrument session and Resource Manager actually work as expected.
It is when the VBA exits the subroutine and where I assume it Garbage Collects any objects and returns back to the spread sheet is where the crash occurs.
I also posted this issue in another Microsoft forum: https://docs.microsoft.com/en-us/answers/questions/613052/simple-visual-basic-application-crashes-ex...
Nov 24 2021 10:09 AM
Managed to resolve the issue by uninstalling MS Office 365 the second time around from Programs and Features.
Going to my companies IT provided MS Office 365 portal (URL was something portal.office.com and logged in with my work email).
Clicking on the Install Office button and downloading a OfficeSetup.exe
Running the .exe to reinstall MS Office 365 applications with Administrator privileges
Launch my Excel program with the VBA code referencing VISA-COM Library 5.12 and ran it without the crash anymore.
So the bug looks to be happening when the MS Office 365 was updated and it basically breaks the Exit Sub process when objects in the VBA program are supposed to be Garbage Collected.