This documentation is archived and is not being maintained.

Office Programming (How Do I in Visual Basic)

This page links to Help on widely used Office programming tasks. They show Visual Basic example code in the context of Visual Studio Tools for Office. To view other categories of popular tasks covered in Help, see How Do I in Visual Basic.

How to: Upgrade Solutions from Visual Studio Tools for Office

Describes the steps to take in order to take advantage of the new project system and tools offered in the latest version of Microsoft Visual Studio Tools for the Microsoft Office System.

How to: Install Office Primary Interop Assemblies

Provides steps for installing the required Microsoft Office primary interop assemblies on end user computers.

How to: Set Up Configuration Information for an Office Solution

Describes how you can manually add a .config file to your Office project.

How to: Create Visual Studio Tools for Office Projects

Describes how to use the Microsoft Office Project Wizard to create a Word or Excel project using a new or existing document or workbook.

How to: Add Windows Forms Controls to Office Documents

Describes how you can add Windows Forms controls to Excel and Word documents at design time or at run time.

Walkthrough: Granting and Removing Permissions for an Office Solution (2003 System)

Provides a step-by-step demonstration of the basics of security in Visual Studio Tools for Office solutions.

How to: Deploy Office Solutions (2003 System)

Describes three different ways to deploy an Office solution: deploying the document and assembly on a network, deploying them locally, or deploying the assembly on a network and the document locally.

Walkthrough: Inserting Text into a Document from an Actions Pane

Steps you through the process of creating an actions pane that populates a Word document with text that the user types in the actions pane.

How to: Create and Modify Custom Document Properties

Describes how you can create and modify custom document properties if there is additional information you would like to store with a document or workbook.

How to: Run Excel Calculations Programmatically

Demonstrates how to use the Calculate method to run all calculations in a range, as well as in all open workbooks.

How to: Handle Errors in Office Projects

Explains how the interaction of managed and unmanaged code affects error handling in Microsoft Office Word and Microsoft Office Excel projects.

How to: Display a String in a Worksheet Cell

Demonstrates how to display text in a cell programmatically. You can create a named range to reference the cell.

How to: Use Built-In Dialog Boxes in Word

Provides an example that shows how to take advantage of Word's built-in dialog boxes to display user input.

How to: Create Office Toolbars Programmatically

Provides an example showing how to programmatically create a toolbar containing two buttons in Word.

How to: Create an E-Mail Item

Provides an example that shows how to create an e-mail item in Microsoft Outlook.

How to: Add Custom Icons to Toolbar and Menu Items

Provides an example that applies an icon to a command on a custom menu.

How to: Programmatically Cache a Data Source in an Office Document

Shows how to add a data source to a document cache programmatically by calling the StartCaching method and passing in the data source.

How to: Map Schemas to Word Documents Inside Visual Studio

Demonstrates how to map an XML schema to a document while the document is open in a Visual Studio Tools for Office project, using the same Word tools that you use when the document is open outside of Visual Studio.

Walkthrough: Simple Data Binding in a Document-Level Project

Steps you through the basics of binding a single data field in a SQL Server database to a named range in Excel.

How to: Populate Documents with Data from Objects

Shows how accessing data that is stored in objects from Word documents is similar to working with Windows Forms projects.

Document-Level Samples

These samples demonstrate how to use Microsoft Visual Studio Tools for the Microsoft Office System to take advantage of features available in Microsoft Office Word and Microsoft Office Excel.