COMException (0x80004005) when accessing Interop.Word.XMLNode properties

In our Word VSTO application we have sometimes the problem that accessing the properties (e.g. BaseName) of an XmlNode throws an exception although the XmlNode reference itself is valid (i.e. not null). In some cases we also found out, that when setting a breakpoint on a line like

string baseName = myXmlNode.BaseName;

the first time watching the myXmlNode.BaseName displayes the exception and few seconds later the same property can be read without an exception.

The XmlNode has been created in the header/footer of the Word document.

Any idea how we can avoid or work around this problem

Thanks,
Joe



Answer this question

COMException (0x80004005) when accessing Interop.Word.XMLNode properties

  • alex2007

    Joe,

    I'm sorry that the XMLNode is not working as you expected. Although you are in a VSTO application, it appears that the issues more specific with the Office interop lib and not with VSTO per se.

    I recommend that you install the Word 2003 XML toolbox so that you can track events with the XML Node. I have a link to this and other great Word dev resources here:

    http://blogs.msdn.com/johnrdurant/archive/2005/12/16/word_developer_resources.aspx

    John.



  • COMException (0x80004005) when accessing Interop.Word.XMLNode properties