I have an application-level VSTO add-in developed using VS2008 for Excel. One of the features of the add-in is to display a Winforms Form (modal dialog) containing a .NET WebBrowser control. The add-in code hooks the DocumentCompleted event for the control, and during the handling of that event we access the page's DOM to get an HtmlElement.This code:HtmlElement elem = browser.Document.GetElementById ("mySpecialSpanId");HTMLSpanElementClass spanElem = elem.DomElement as HTMLSpanElementClass;spanElem.HTMLElementEvents_Event_onpropertychange += new HTMLElementEvents_onpropertychangeEventHandler works fine on Windows 7 64-bit running Office 2010 32-bit. But it fails on Windows 7 64-bit running Office 2010 32-bit. The failure is that the third line adding the event handler throws because spanElem is null using 64-bit Office, but works fine using 32-bit Office. Root cause is that using 64-bit Office, the type of spanElem is: System.__ComObject not HTMLSpanElementCLass as it is on 32-bit Office.
Visual Studio/Team Foundation Server/.NET Framework Tooling Version
Steps to reproduce
Operating System Language