VSTO Excel Crashes in Debug
Here's the solution for VSTO unable to Debug:
Symptom:
In Visual Studio, Debug (F5) launches Excel, then vanishes.
Solution:
Create an XML file called Excel.Exe.Config:
<configuration
<startup
<supportedRuntime version="v1.1.4322"/
<supportedRuntime version="v1.0.3705"/
</startup
</configuration
The versions must match what you find in C:\Windows\Microsoft.Net\Framework
Place Excel.Exe.Config in the folder that contains Excel.Exe,
probably C:\program files\Microsoft Office\Office11
--
Bob Sullentrup
"Otto" wrote:
All of my experience is with VSTO 2003.
Open Excel, go to help/About MS Excel.
In the About window, there is a "Disabled Items" button in the lower right
corner.
Pressing it will get you a list of problem office docs. You can re-enable
them from here.
This may fix your problem. You may also want to check the Task Manager for
more than 1 instance of excel.exe. This may be part of the problem too.
In addition, VSTO handles errors in a strange way. If your code throws an
exception, execution stops and returns to the document, with no indication of
an error. When in doubt, put a try/catch block around all code that
interfaces with document objects. Use the Debug.Writeline() method to give
you an idea what the problem is.
VSTO is a quantum leap over VBA (even in C#), but it takes some getting used
to.
"Bob Sullentrup" wrote:
Folks,
I created a new VSTO Excel project, put a MessageBox in the WB_Open event,
and hit the 'Debug'. Excel tried to load, then went south.
When I open the workbook outside of .NET, the workbook opens and the
MessageBox appears.
What might be causing Excel to crash in VSTO?
--
Bob Sullentrup
|