Skip to Main Content
Visual Studio Hacks
book

Visual Studio Hacks

by James Avery
March 2005
Intermediate to advanced content levelIntermediate to advanced
304 pages
19h 23m
English
O'Reilly Media, Inc.
Content preview from Visual Studio Hacks
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 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Microsoft Visual Studio 2015 Unleashed, Third Edition

Microsoft Visual Studio 2015 Unleashed, Third Edition

Mike Snell, Lars Powers
.Net Framework Essentials

.Net Framework Essentials

Thuan L. Thai, Hoang Lam
C# 5.0 Unleashed

C# 5.0 Unleashed

Bart De Smet
Programming .NET Security

Programming .NET Security

Adam Freeman, Allen Jones

Publisher Resources

ISBN: 0596008473Errata Page