
Create a Command Bar in Word 2003 #84
Chapter 11, Visual Studio Tools for Office
|
367
HACK
Considerations
Keep the following in mind when developing with the VSTO.
Handling optional parameters. You may find that writing the same applica-
tions for the VSTO will take more effort to accomplish the same task
depending on what language you are using. Take, for example, the follow-
ing code to create a new Excel workbook in VB.NET:
Dim wb As Excel.Workbook = _
ThisApplication.Workbooks.Open("C:\VSHacks\LoanCalc.xls")
However, to accomplish the same thing in C#, you would need to type the
following:
Excel.Workbook wb = ThisApplication.Workbooks.Open(
"C:\\VSHacks\\LoanCalc.xls", 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);
Closing the debugger closes Office application. If you are debugging your new
Office application through Visual Studio, you will find that if you close your
document, you will be returned to Visual Studio to continue working with
the code. However, if you close Visual Studio or stop the execution of your
code (by clicking the Stop Debugging button or pressing Shift-F5), you will
also close your Office application—any work that you did in your Office
document will not be saved and you won’t be prompted to save your work.
COM-based assemblies ...