« Werewolf party game | Main | Avoiding Out of Memory Exceptions in .NET »

Creating a Word Add-in using Visual Studio 2005 beta 2

Visual Studio 2005 beta 2 includes the beta 2 version of Visual Studio Tools for Office, but it lacks a template for creating a Word Add-in.

Here’s how you can create one manually:

1.      Create a new Class Library project.

2.      Go to Application tab of the project’s properties:

a.       Click Assembly Information…

b.      Click “Make assembly COM-Visible

3.      Go to Build tab of the project’s properties:

a.       Check “Register for COM interop”

4.      Add references to:

a.       C:\Program Files\Common Files\Microsoft Shared\MSEnv\PublicAssemblies\extensibility.dll

5.      Add “using” statements to the class file for the following:

using Extensibility;

using System.Runtime.InteropServices;

6.      Add a Guid attribute to the class:

[Guid("E1234594-4A14-4a6f-8612-6019EB11CE70"), ProgId("MyDomain.MyWordAddInClass")]

7.      Create a setup project for the class library.

a.       Under the Registry settings to be created by the setup project add the following key:

                                                               i.      HKEY_CURRENT_USER/Software/Microsoft/Office/Word/Addins/MyDomain.MyWordAddInClass

b.      Under this key, create the following values:

                                                               i.      Description (string) = “My Description”

                                                             ii.      FriendlyName (string) = “My Friendly Name”

                                                            iii.      LoadBehavior (DWORD) = 3

That’s it. You should be able to build, install, and uninstall the add-in.

 

Post a comment

(If you haven't left a comment here before, you may need to be approved by the site owner before your comment will appear. Until then, it won't appear on the entry. Thanks for waiting.)