I'm have a program (GUI) that interfaces with excel to execute macros. We're using Microsoft.Office.Interop.Excel to call/run the macros and this works great.
What I can't figure out is a good way to cancel the macros from the GUI.
One idea we had was to use the excel.application variable that runs the macros to write a "stop" value to a specific cell in the workbook, and in the macros (they are all mostly loops), check for the "stop" value in that cell.
This crashes my GUI with this
The program '[2188] BVLReports.vshost.exe: Managed' has exited with code -336589910 (0xebf00baa).
And excel gets tied up, and won't respond. I know how to Exit Sub
from within the macro if the "stop" value exists, so I don't need answers on how to check/cancel from inside the macro. Any ideas on a better way to write this "stop" value or a better way to cancel the macros externally?
Thanks