Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

Automating Word Applications (How Do I in Visual Studio Tools for Office)

This page provides links to Help for commonly performed tasks that make use of the Microsoft Office Word 2003 object model in Microsoft Visual Studio 2005 Tools for the Microsoft Office System. To see other categories of key tasks covered by Visual Studio Tools for Office Help, see How Do I in Visual Studio Tools for Office.

How to: Install Office Primary Interop Assemblies

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

Word Tasks

Provides links to examples of commonly performed tasks that make use of the Word 2003 object model in Visual Studio Tools for Office.

How to: Automate Objects Using Managed Code

Shows how to declare a variable, assign an object to it, and then convert or cast the object to the correct type.

How to: Automate Office Applications By Using Primary Interop Assemblies

Describes how you can use managed code to automate other Office applications, such as Microsoft Office PowerPoint 2003.

Getting Started Programming Document-Level Customizations for Word

Describes what you need to know to get started creating Word 2003 applications using Visual Studio Tools for Office.

How to: Create Event Handlers in Visual Studio Tools for Office

Describes various ways to create event handlers in Visual Basic and C#, whether you are in design view or code view.

How to: Update Bookmark Text

Explains how you can use the Range property of a Bookmark object to insert text into a placeholder bookmark so that you can retrieve the text at a later time, or to replace the text inside of a bookmark that already contains text.

How to: Add Bookmark Controls to Word Documents

Describes several ways to add Bookmark controls: programmatically, from within Word, using the Visual Studio Toolbox, and using the Data Sources window.

How to: Resize Bookmark Controls

Demonstrates the various ways to resize bookmark controls, including adding text to the bookmark, recreating the bookmark, and setting the start and end properties in the Properties window.

Walkthrough: Creating Shortcut Menus for Bookmarks

Demonstrates how to write code in the BeforeRightClick event handler of a Bookmark control to display a shortcut menu when the user right-clicks text in a bookmark.

How to: Reference Documents in the Documents Collection

Shows how to refer to a Document object by using the document's name or its index value in the collection.

How to: Create New Documents

Shows how to use the Add method to create a new Word 2003 document based on Normal.dot or based on a custom template.

How to: Open Existing Documents

Demonstrates how to use the Open method to open the existing Word 2003 document specified by a fully qualified path and file name.

How to: Save Documents

Demonstrates several ways to save and close Word 2003 documents, depending on what you want the end result to be.

How to: Close Documents

Provides examples of using the Close method to close an active document without saving changes, or saving changes without prompting the user.

How to: Display Documents in Print Preview

Provides an example showing how you can display a document in Print Preview mode by setting the active document's PrintPreview property to True.

How to: Print Documents

Shows how you can use the PrintOut method to send a Word document (or part of a document) to a printer.

How to: Protect Documents and Parts of Documents

Describes how to protect data in an Office document from being revised as well as how to unprotect certain portions of the document.

How to: Hide Text in Documents

Shows how to set the font of a range of text so that the text is hidden.

How to: Define and Select Ranges in Documents

Demonstrates how to define a range in a Word 2003 document by using the Range method of a Document object to supply a start value and an end value.

How to: Count Characters in Documents

Explains how to determine the number of characters in a document by using the Count property of the Characters collection.

How to: Reset Ranges in Word Documents

Shows how to use SetRange to resize an existing range.

How to: Extend Ranges in Documents

Provides an example showing how to define a Range object and extend its current range by using its MoveStart and MoveEnd methods.

How to: Collapse Ranges or Selections in Documents

Shows how to collapse a Range in a Word 2003 object and insert new text.

Word Controls Sample

Demonstrates how to access the events of managed controls on a Word 2003 document from a Visual Studio Tools for Office project assembly.

Document Protector Sample

Provides a tool that protects the entire document and then enables you to unprotect any or all bookmarks, form fields, and XML nodes that are in the document.

PowerPoint Deck Generator Sample

Contains a Word 2003 template that enables you to easily create a PowerPoint presentation from a Word document, without having to copy information from your Word outline and paste it into PowerPoint.

PowerPoint Script Generator Sample

Contains a Word 2003 template that lets you create a Word document from a PowerPoint presentation, without having to copy information from PowerPoint and paste it into Word.

Actions Pane Subpane Control Sample

Demonstrates custom user controls on an actions pane, and includes a collapsible container control (the subpane control) that helps you organize controls on an actions pane.

How to: Search for Text in Documents

Shows how you can use either the Selection or the Range object to search for text in Word 2003 documents.

How to: Set Search Options in Word

Describes the two ways to set search options for selections in Word 2003 documents.

How to: Loop Through Found Items in Documents

Demonstrates how to use the Found property of the Find method, which returns true whenever a searched-for item is found.

How to: Search for and Replace Text in Documents

Shows how to use the Find object to loop through a document looking for specific text, formatting, or style, and use the Find object's Replacement property to replace any of the items found.

How to: Restore Selections After Searches

Shows how you can restore the user's original selection after a search is completed.

How to: Create Word Tables

Demonstrates how to add a simple table to a document and provides other examples of how to work with the Table object in Word 2003.

How to: Add Text and Formatting to Cells in Word Tables

Provides an example showing how you can work with the Cell object to add text and formatting to table cells.

How to: Add Rows and Columns to Word Tables

Provides the code needed to add a row and a column to a table.

Walkthrough: Displaying Text in a Text Box in a Document Using a Button

Demonstrates some basic principles of using buttons and text boxes on Word 2003 documents.

Walkthrough: Changing Document Formatting Using CheckBox Controls

Demonstrates how to use check box controls on a Word 2003 document to change text formatting.

Walkthrough: Updating a Chart in a Document Using Radio Buttons

Demonstrates the basics of changing chart styles using option buttons on a document.

Walkthrough: Binding Data to Controls on a Word Actions Pane

Demonstrates binding data to controls on an actions pane in Word 2003. The controls demonstrate a master/detail relation between tables in a SQL Server database.

Walkthrough: Creating Shortcut Menus for Bookmarks

Demonstrates how to write code in the BeforeRightClick event handler of a Bookmark control to display a shortcut menu when the user right-clicks text in a bookmark.

How to: Insert Text into Word Documents

Describes the three primary ways to insert text into Word 2003 documents.

How to: Retrieve Start and End Characters in Ranges

Shows how to retrieve the character positions of the start and end positions of a range by retrieving the Start and End properties of the Range object.

How to: Format Text in Documents

Shows how to use the Range object in Word 2003 to format text.

How to: Exclude Paragraph Marks When Creating Ranges

Provides an example that shows how to control paragraph structure when inserting text into Word 2003 documents.

How to: Search for Text in Documents

Shows how you can use either the Selection or the Range object to search for text in Word 2003 documents.

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 2003 tools that you use when the document is open outside of Visual Studio.

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

Show:
© 2014 Microsoft