Creating an Addin

In this section, you'll create a simple "hello world" add-in so that you can become familiar with the VSTO 2005 SE add-in programming model.

1. Open Visual Studio and create a new project by clicking File | New Project.

2. Select the 2007 Add-in node, and in the New Project dialog box, select PowerPoint Add-in.

3. Keep the default name for the add-in, and click OK.

4. Right-click ThisAddin.vb in Solution Explorer, and click View Code.

5. Add the code in Listing 14.1 to the Startup event handler of ThisAddin.

Listing 14.1. Adding code to the Startup event handler of a PowerPoint add-in

Private Sub ThisAddIn_Startup(ByVal sender As Object, _ ByVal e As System.EventArgs) Handles Me.Startup

MsgBox(Me.Application.Name & " " & _ Me.Application.Version)

End Sub

6. Press F5 to run the code. When the application opens, the product name and version should appear in a message box.

Now that you know how to create an add-in using VSTO 2005 SE, you can extend the add-in by adding code to customize the Ribbon, create a Custom task pane, or create an Outlook form region.

0 0

Post a comment