When is .NET for Office?

Thomas Williams asks “When is .NET for Office..I’m sick of using VBA!”

Good question!

To some extent, .NET for Office is here today. This year, my team released a new product in the Visual Studio product family with the mind-numbingly long name “Visual Studio Tools for the Microsoft Office System”. Fortunately, we’ll also let you call it “Visual Studio Tools for Office” or just VSTO. 

For more information on this product see https://msdn.microsoft.com/office/understanding/vsto/ or https://msdn.microsoft.com/msdnmag/issues/03/09/MicrosoftOffice2003/

VSTO allows you to use the full power of Visual Studio and .NET to program against Word and Excel. It allows you to associate a managed assembly with a Word or Excel document so when that document is opened in Word and Excel, your managed code will start up and run. It supports both the VB.NET and C# languages. And the IDE is full Visual Studio with all the power thereof.

You can also write managed code against other Office applications such as Outlook, PowerPoint, etc. Most Office applications have provided something called a PIA (Primary Interop Assembly) which is just a fancy way of saying it is a .NET assembly you can reference that lets you talk to the COM based objects models of the Office applications from managed code. The object model provided by the PIA looks almost exactly like the object model you are already using in VBA—so there aren’t any radical improvements on that front. With Office 2003 you can install these PIAs as part of the installation if you check the “.NET Programmability Support” options. See https://msdn.microsoft.com/library/default.asp?url=/library/en-us/dv_wrcore/html/wrtskInstallingOfficePrimaryInteropAssemblies.asp

Coming in Visual Studio 2005, my team is currently working on the successor to VSTO called (strangely enough) VSTO 2.0. VSTO 2 will provide a lot of additional tools and starts to deliver on the promise of making Office development easier utilizing ideas that I will describe in more detail in this blog.

And you can be sure that you will continue to see more and more innovation in this space as Office programming really becomes just as natural a part of .NET as WinForms or ASP.NET is today.

But don’t wait—try out VSTO as soon as you can. It provides a much richer development environment than VBA—multiple language support, all the richness of the .NET frameworks, and lots of other great things that will make you more productive as a developer. In short, .NET for Office is now!