Freigeben über


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!

Comments

  • Anonymous
    April 05, 2004
    The comment has been removed
  • Anonymous
    April 11, 2004
    We have a fairly large Word add-in written in C# and implementing the IDTExtensibility2 interface. How could it benefit from migrating it to the VSTO framework? In principle, how is the VSTO framework superior to COM add-ins when doing the implementation in a .NET language? At first sight, it seems at least the deployment/registration problems could be alleviated, but there may be even better advantages.
  • Anonymous
    April 12, 2004
    VSTO 1.0 and VSTO 2.0 don't really address the general purpose IDTExtensibility2 add-in problem. There's some code in Office that lets you load a smart tag via the VSTO 1.0/2.0 loader thereby getting your own app domain. But this only works with smart tags, not add-ins. There are a lot of advantages to using the VSTO framework if you are doing template or document level addins--but I'm not sure if you could refactor your Word add-in to be template based. We will solve the general purpose application managed add-in problem and make that a lot easier, but it doesn't look like that will happen in the VSTO 2.0/Office 11 timeframe. You'll have to wait until Office 12 for better general purpose add-in support from VSTO.
  • Anonymous
    May 24, 2004
    Please help me with the questions below for .net Office:
  • Anonymous
    June 19, 2004
    Hi;

    I have a complete program in VSTO/C# that does everything I need. But now I'm trying to write an installer and it appears that I have to set an absolute directory for the dll in the dot file.

    Am I missing something or is that the only way to do it? (I've tried a relative directory but that appears to be based on the default directory at the time Word opens the template and that can be anything.)

    thanks - dave
    david@thielen.com
  • Anonymous
    June 21, 2004
    What version of VSTO are you using?