API Support » API failing when Excel not primary Focus Jan 09, 2020 @ 07:35 PM (Total replies: 4) | |||||
When using the API through a custom, times VBA macro, the API throws an error if the Excel window no longer has the focus. Below is the stack trace thrown at the time of error. ----------------------------------------------------------------------- See the end of this message for details on invoking just-in-time (JIT) debugging instead of this dialog box. ************** Exception Text ************** System.Runtime.InteropServices.COMException (0x800A03EC): Unable to get the Text property of the Range class at System.RuntimeType.ForwardCallToInvokeMember(String memberName, BindingFlags flags, Object target, Int32[] aWrapperTypes, MessageData& msgData) at Microsoft.Office.Interop.Excel.Range.get_Text() at OEC.Functions.FillStaticTable(String DDE, String topic, Range ColumnNames, Range IDs, Boolean allowSpace) at OEC.Functions.c__DisplayClass4.b__3() ************** Loaded Assemblies ************** mscorlib Assembly Version: 2.0.0.0 Win32 Version: 2.0.50727.5420 (Win7SP1.050727-5400) CodeBase: file:///C:/Windows/Microsoft.NET/Framework/v2.0.50727/mscorlib.dll ---------------------------------------- OpenECryAddIn Assembly Version: 1.0.0.0 Win32 Version: 1.0.0.0 CodeBase: file:///C:/Program%20Files%20(x86)/OEC/Trader%20Excel%20Add-In/OpenECryAddIn.DLL ---------------------------------------- Interop.Microsoft.Office.Interop.Excel Assembly Version: 1.6.0.0 Win32 Version: 1.6.0.0 CodeBase: file:///C:/Program%20Files%20(x86)/OEC/Trader%20Excel%20Add-In/Interop.Microsoft.Office.Interop.Excel.DLL ---------------------------------------- System.Windows.Forms Assembly Version: 2.0.0.0 Win32 Version: 2.0.50727.5420 (Win7SP1.050727-5400) CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Windows.Forms/2.0.0.0__b77a5c561934e089/System.Windows.Forms.dll ---------------------------------------- System Assembly Version: 2.0.0.0 Win32 Version: 2.0.50727.5420 (Win7SP1.050727-5400) CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll ---------------------------------------- System.Drawing Assembly Version: 2.0.0.0 Win32 Version: 2.0.50727.5420 (Win7SP1.050727-5400) CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Drawing/2.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll ---------------------------------------- System.Xml Assembly Version: 2.0.0.0 Win32 Version: 2.0.50727.5420 (Win7SP1.050727-5400) CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Xml/2.0.0.0__b77a5c561934e089/System.Xml.dll ---------------------------------------- ************** JIT Debugging ************** To enable just-in-time (JIT) debugging, the .config file for this application or computer (machine.config) must have the jitDebugging value set in the system.windows.forms section. The application must also be compiled with debugging enabled. For example: When JIT debugging is enabled, any unhandled exception will be sent to the JIT debugger registered on the computer rather than be handled by this dialog box. ----------------------------------------------------------------------- How can we get around this? In our situation, Excel does not always have the focus but we need the macros and APIs to continue working without issue. |