Managed Code and Office Programming with Visual Studio
The key technology that makes creating an integrated Microsoft Office solution possible is Automation, which is part of the Component Object Model (COM) technology. Automation enables you to use code to create and control software objects exposed by any application, DLL, or ActiveX control that supports the appropriate programmatic interfaces.
Automation Using Managed Code
Microsoft Office applications expose much of their functionality to Automation. However, you cannot use managed code (such as Visual Basic or C#) directly to automate COM-based technology such as Microsoft Office applications. To work with unmanaged COM objects using managed code in Visual Studio, you must use an interop assembly. For more information, see.
Microsoft Visual Studio 2005 Tools for the Microsoft Office System (VSTO 2005) additionally exposes host controls that extend existing Microsoft Office Word 2003 and Microsoft Office Excel 2003 objects. The host controls add data binding and programmable events to objects such as bookmarks and named ranges. For more information about host controls, seeand .
Visual Studio can help you incorporate Microsoft Office applications into your custom solutions by providing projects and classes to make Automation easier for some Microsoft Office applications. You can also use Visual Studio as your development environment for other Microsoft Office applications that do not have dedicated projects in Visual Studio Tools for Office.
Visual Studio Tools for Office includes templates for two types of projects: document-level customizations and application-level add-ins. For more information, see.
VSTO 2005 includes document-level project templates for Word 2003 and Excel 2003. These project templates contain references to required assemblies and also contain useful classes and methods. For more information, see.
Document-level projects are extensible, similar to other kinds of Visual Studio projects. For example, you can add references to any other managed code assembly to your solution; however, you cannot reference another Visual Studio Tools for Office project assembly. For more information, see.
VSTO 2005 includes an Outlook 2003 add-in project template, and Microsoft Visual Studio 2005 Tools for the 2007 Microsoft Office System (VSTO 2005 SE) includes add-in project templates for many more applications in Microsoft Office 2003 and the 2007 Microsoft Office system. These project templates contain references to required assemblies and they also contain useful classes and methods. For more information, see, , and .
For more information about the differences between VSTO 2005 and VSTO 2005 SE, see.
Other Office Applications
If you want to use managed code to automate other Microsoft Office applications, such as Microsoft Office Access, you can still use Visual Studio as your development environment. However, there are no project templates for these other applications; instead, you must perform additional steps in your existing projects to be able to call unmanaged code using Visual Basic or C#. For more information, see.
For more information about using managed code to develop solutions using Office applications, see the following technical articles:
Microsoft Office Development with Visual Studio (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnoxpta/html/vsofficedev.asp).
INFO: Develop Microsoft Office Solutions with Visual Studio .NET (http://support.microsoft.com/default.aspx?scid=kb;en-us;q311452).
Automate Microsoft Office Access 2003 from Microsoft Visual Basic .NET (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/odc_ac2003_ta/html/odc_acautomatevbnet.asp)
Creating Managed FrontPage 2003 Add-ins in C# (http://msdn.microsoft.com/library/en-us/odc_fp2003_ta/html/odc_fpManagedFrontPageAddIns.asp?frame=true).