Marshal.GetActiveObject("Excel.Application") line fails
Author: timprice7
Creation Date: 2/21/2014 4:39 PM
profile picture

timprice7

#1
In my WealthLab strategy I would like to use a third party .dll that communicates with an Excel spreadsheet using interop. Is there something about compiling a strategy in WealthLab that might prevent this from working?

Here are some details...

I can access this .dll with no problems from a non WealthLab winforms app.
When I access the .dll from within a WealthLab strategy, the .dll is unable to communicate with Excel. The following line of code in the .dll throws a general exception error....
try
CODE:
Please log in to see this code.

(see key namespaces listed below)


It seems that for some reason it cannot access the running object table (rot). Is there anything you can think of that would cause this problem?

Thanks,
Tim

The key namespaces that the 3rd party .dll uses are...
CODE:
Please log in to see this code.



My system specs are
Windows 7
WealthLab 6.6 (64 bit)
Excel 13 (64 bit)
Microsoft Access Database Engine _64 2010
profile picture

Eugene

#2
According to MSDN, Marshal.GetActiveObject throws a general COMException. What does it say in particular?
profile picture

timprice7

#3
COMException is The object was not found.

Not very useful. Anyway, Excel is definitely running and I created a non WealthLab winforms app that I can run and it can find "Excel.Application" every time.
profile picture

Eugene

#4
Sorry but this ain't my area of expertise (I don't even have Excel installed). Maybe this workaround could be of any help to you:

PRB: Visual C# .NET Error Attaching to Running Instance of Office Application

If nothing helps you can work with Excel using ADO.NET.
profile picture

timprice7

#5
I solved the problem by running the Windows Compatibility program on the WealthLabPro.exe. It recommended that WealthLab be run in compatibility mode (Windows XP Service Pack 2). I don't know why it was a problem or why it was solved by this but I'm happy it worked.
Any idea of what might be going on here or if there is any disadvantage to running WealthLab in this compatibility mode?

FYI-I just found this...
http://technet.microsoft.com/en-us/library/ee449431%28WS.10%29.aspx
and this...
http://windows.microsoft.com/en-US/windows7/install-and-use-windows-xp-mode-in-windows-7


This website uses cookies to improve your experience. We'll assume you're ok with that, but you can opt-out if you wish (Read more).