Author |
Topic: API failing when Excel not primary Focus (5 messages, Page 1 of 1) |
||||
---|---|---|---|---|---|
Moderators: VPfau | |||||
RSummerall1402 Posts: 1 Joined: Jan 02, 2020 |
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. |
||||
VPfau Moderator Posts: 164 Joined: |
Please provide more details.
What API and version do you use, what Excel version is it? Vitaliy Pfau
|
||||
AGagnon3661 Posts: 5 Joined: May 17, 2019 |
Here's what I was able to gather so far.
1. Excel version is 2007 pro 2. API version is unknown, except we know it is a DDE link |
||||
JSmith5611 Posts: 187 Joined: |
My guess by the stack trace is that you are using the COM library, not DDE (we haven't supported dde in quite a while)
We do have an initial release of our new COM api available now: https://api.gainfutures.com/WebAPI/api/Files/DownloadClientUpdate?clientUpdateId=2174 (64bit) https://api.gainfutures.com/WebAPI/api/Files/DownloadClientUpdate?clientUpdateId=2175 (32bit) If you aren't dead-set on using COM through excel, our .NET api is available through nuget ( https://www.nuget.org/packages/GFAPI/ ) The documentation between the GFAPI and GF COM api are mostly equivalent: https://gainfutures.com/GFAPI/ I also have a new excel sample that uses the new COM API if you need it. Jason Smith
|
||||
AGagnon3661 Posts: 5 Joined: May 17, 2019 |
Hi Jason,
Sorry for the delay, there was some issues in our process that made it that I had to wait to get back on this. If you could send me that new file that would be very helpful. We're hoping to turn this around in a fairly short time frame from here. Al |
||||