SgDotNet
Singapore Professional .NET User Group -For Cool Developers

IXMLDOMNodeList casting between Excel and .NET

rated by 0 users
This post has 0 Replies | 1 Follower

Top 10 Contributor
Posts 2,284
icelava Posted: 03-10-2006 5:04 PM

I have a .NET program that obtains XML via Excel (which obtains from a web service). (And if one is wondering why such a long "tunnel" has be established, please don't ask - that's a lengthy political topic that would be out of scope).

Within it is a VBA function which returns an IXMLDOMNodeList. Since the Excel.Run() method in .NET only views it as an object it has to be casted. Today the code running on my machine just bombed out on me with "specified cast is not invalid" exception.

The first time i inherited this project I hit the same error but was able to resolve it by re-referencing the correct MSXML library. Now, I have tried _all_ versions of MSXML library to no avail. The Excel project references MSXML 3.0 and matching it did not help. The odd thing is the very same binaries I passed to a colleague's laptop run fine. Yes, I have done the _mandatory_ reboot of my machine but that didn't help.

Has anybody ever seen such a thing? thanks,

// this will fail cast.
IXMLDOMNodeList assmList =
(IXMLDOMNodeList)this.jobPackage.ExcelApplication.Run("GetAssessmentList",
this.record.ClassCode , Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing);

UPDATE: PROBLEM SOLVED

Bloody hell. It is a bug in MSXML 3.0. Installing SP7 did the trick.

The melody of logic will always play out the truth. ~ Narumi Ayumu, Spiral

Page 1 of 1 (1 items) | RSS
Copyright SgDotNet 2004-2008
Powered by Community Server (Commercial Edition), by Telligent Systems