O'Reilly logo

Microsoft® Visual Basic® .NET Programmer's Cookbook by Matthew MacDonald

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Drive Microsoft Word

Problem

You want to interact with Microsoft Word, either to automate a business task or to read and write Word documents.

Solution

Use the Word Automation objects included with Microsoft Office.

Discussion

Microsoft provides a rich object model that you can use to interact with Word and other Office applications. You can use these objects to create and read Word documents, automate complex or repetitive batch tasks, and even access Word features like the spelling dictionary.

To use Automation with Microsoft Word, you must first add a reference to the necessary COM library. Right-click your project in the Solution Explorer, select Add Reference, and choose the COM tab. Find the Microsoft Word Object Library item in the list, and ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required