Visual Studio Tools for Office: Using C# with Excel, Word, Outlook, and InfoPath



Visual Studio Tools for Office: Using C# with Excel, Word, Outlook, and InfoPath

I have been using Visual Basic for Applications (VBA) within the Microsoft Office family of applications for more than 10 years, yet I still recall the surge of empowerment I experienced when my first VBA-enabled Excel workbook turned a static spreadsheet into an autonomic formatting and reporting machine. A long time has passed, and Microsoft has elevated the .NET Framework to be the all-encompassing, universal pathway to Microsoft application automation. For those like me, migrating from the familiar confines of VBA to the lesser-known .NET VSTO became a much easier and rewarding experience on account of the clear explanations and detail presented in this book. Authors Eric Carter and Eric Lippert agree, and have written the definitive tome on making this leap to .NET office automation even easier.


As the subtitle of the book states, it teaches readers about Microsoft Excel, Word, Outlook, and InfoPath automation using the C# programming language. The first two chapters orient the reader to the object models used for .NET office automation, as well as give a flavor of how the C# language is used to instantiate and manipulate objects exposed by the toolkit. About half the book then explores .NET object models and code examples for Excel, Word, Outlook (taking up a majority of the pages), and InfoPath. The remaining half of the book explores using Windows Forms with the toolkit, creating custom extensions and Office add-ins, and manipulating the Office containers and features (such as the action panes, smart tags, client- and server-side data models, .NET code security and deployment, and even consuming and manipulating XML in Excel, Word, and InfoPath). Throughout these chapters, the authors (both of whom are Microsoft employees, with Eric Carter being the lead developer on VSTO) supply clear explanations and ample code to demonstrate the concepts.


While this book is invaluable for Office developers, it s not perfect. Given my VBA background, I would have preferred to see side-by-side code comparisons between VBA and C#, as it seemed in some cases that it took more lines of C# to accomplish the same thing in VBA. Also, beyond strictly teaching the objects and processes required to manipulate Office objects, it would have been great to see an ber-Office automation example tying in everything learned into an application that really demonstrated the power of what .NET and Office can do together. Something like a smart tag that, when selected, populated an Excel chart for a selected individual in a list, compiling server-based data and formatting it especially for that person, embedding that chart into a Word document with additional detail (like a 401k statement, for example), and ultimately attaching that document to a formatted Outlook message. There s also nary a word on where the sample code can be downloaded it s not available from the book s Web site, and no URLs are disclosed in the book. Lastly, it would have been useful insight to at least acknowledge Access in the VSTO context and what plans, if any, the VSTO team has to incorporate this major Office application into the VSTO model.


Even with these minor criticisms, this book will without question accelerate understanding and practical use of the technology, particularly for those progressive developers who have already realized the power of leveraging the .NET Framework and the familiarity of the C# syntax for automation contexts.


Mike Riley



Title: Visual Studio Tools for Office: Using C# with Excel, Word, Outlook, and InfoPath

Authors: Eric Carter and Eric Lippert

Publisher: Addison-Wesley

ISBN: 0-321-33488-4

Web Site:

Price: US$49.99

Page Count: 1,008



Hide comments


  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.