David Thielen  
Home On Programming Articles, Etc. Blogs Resume

Write a Word Add-In – Part 0

Learn to write an add-in in C# that does everything a regular C# program does.

Introduction

I first wrote the article in Part I. But after writing it based on some questions and some further information I have come across, I realized that there really needed to be a precussor article. So here is the information I wished I had started with.

One other note. If you are going to write an Add-In, it’s not a trivial task. While very little of it is difficult, there is a lot to learn. And throwing one together quickly without understanding the entire framework is an invitation to disaster. You have to learn this stuff to write an Add-In correctly. (I think is some respects writing an Add-In requires a better understanding of it’s framework than writing a standard windows application.)

Books

The first two books are where you should start. Both are very well written and give you a very comprehensive guide to writing a Word Add-In. I wish I had known about these before I started – they would have saved me weeks of time and anguish. The additional books are very useful for specific needs.
  • Microsoft .NET Development for Microsoft Office – Andrew Whitechapel
  • Developing Microsoft Office Solutions – Keb Bluttman
  • Office 2003 XML – Evan Lenz, Mary McRae, & Simon Laurent.
    • This primarily covers the new xml file formats for the Office applications. They do an excellent job of explaining WordML and a good job of explaining the other formats. If you need to understand the Office xml formats, start with this book.
  • Microsoft Excel 97 Developer’s Kit – Baarns Consulting Group
    • This includes among other things, the xls file format. If you need to read or write xls directly, this is your only source.

Weblinks

VSTO

Exactly what VSTO is for has confused a lot of people (including me). Here is a really good explination from the VSTO Program Manager at Microsoft:

I just wanted to comment on some confusion about what VSTO is used for. VSTO 2005 enables you to create document level solutions in managed code (C# and VB) for Word and Excel. Document level solutions are a little different than Word or Excel add-ins which are application scope. VSTO solutions are tied to a document and the lifetime of the solution is that of the document. When you open the document your code is loaded and run. And when you close the document your code is unloaded. A new feature that was added for Beta2 is the ability to create managed Application level add-ins for Outlook. I hope this clears up any questions you have. Please fell free to contact me with any other questions you have.

Here are some great VSTO resources: