Office development samples

Applies to: yesVisual Studio noVisual Studio for Mac


This article applies to Visual Studio 2017. If you're looking for the latest Visual Studio documentation, see Visual Studio documentation. We recommend upgrading to the latest version of Visual Studio. Download it here

Visual Studio includes sample applications that demonstrate how to use the Microsoft Office developer tools to create Office solutions. The code in these samples illustrates the syntax, structure, and techniques used to build Office solutions.

For the most current samples, see MSDN developer samples: Learn through code on the Microsoft website.


Microsoft provides the included samples "AS IS" with no warranties. The code in the samples is provided just to illustrate concepts. The provided code may not meet security requirements for any specific environment. We recommend that you add security and error-handling code to your projects to make them as secure and robust as you deem appropriate.

Office development samples

Sample Description
Excel Master Detail Data Sample Demonstrates how to retrieve data from a relational database or XML file and use that data in Excel.
Excel Document Protection Techniques Sample Demonstrates various techniques you can use to protect structural components of a worksheet to help to prevent users from accidentally deleting controls or otherwise changing important parts of your solution document.
Excel Data Analysis Sample Demonstrates an inventory management application that executes data analysis tasks in Excel using list objects, pivot tables, and charts.
Word Task Pane Sample Demonstrates how to create a basic custom task pane for Word.
Word Content Controls Sample Demonstrates how to bind Word content controls to database fields.
Outlook Form Region RSS Reader Sample Demonstrates how to use Outlook form regions to display the full content of articles from an RSS feed.
Ribbon Controls Sample This sample demonstrates how to create a custom tab that appears on the ribbon of an Excel worksheet. This custom ribbon demonstrates most of the controls available in the Office Ribbon Controls group of the Visual Studio Toolbox.
UI Manager Sample Demonstrates how to create a ribbon customization, a custom task pane, and a custom form region for Outlook by implementing extensibility interfaces in a VSTO Add-in. Each instance of the ribbon, task pane, and form region can correctly communicate with each other.
VBA and VSTO Interoperability Sample Demonstrates how to call a method in a document-level customization for Excel from Visual Basic for Applications (VBA) code in the workbook.

This sample is only available online.

See also