Microsoft Office Tutorials and References
In Depth Information
When the application is ready to end, you need to properly remove the button using code like
the OnBeginShutdown routine. The button’s Delete method is used to actually remove the
button from the toolbar. Then the resources associated with the button object are destroyed
by setting the MyButton object to Nothing .
Public Sub OnBeginShutdown(ByRef custom As System.Array) _
Implements Extensibility.IDTExtensibility2.OnBeginShutdown
MyButton = Nothing
End Sub
Finally, the code associated with the button’s click event is called whenever My Button is
pressed on the toolbar. As you can see in this example, the MyButton_Click routine merely
calls the MsgBox routine to display a simple message on the screen. However, in a more complex
add-in, routines like this will handle the interactions associated with the add-in for the user.
Private Sub MyButton_Click(ByVal Ctrl As _
Microsoft.Office.Core.CommandBarButton, _
ByRef CancelDefault As Boolean) Handles MyButton.Click
MsgBox("My button was clicked")
End Sub
Installing the Add-In
To install the add-in, you must first build it. Then you must build the installation program
and finally run the installation program.
Choose Build, Build Solution from the Visual Studio .NET main menu. This will
compile your add-in.
The next step is to build the installation program. This is done by right-clicking the
Setup project in the Solution Explorer and choosing build from the context menu.
Note The installation package created by the add-in wizard does not include the .NET
Framework, which must be installed prior to installing your add-in. If you already have
Visual Studio .NET installed on your computer, you also have installed the .NET Framework.
Once the build is complete, right-click the Setup project again and choose Install from
the popup menu. This will run the MyCOMAddinSetup Setup Wizard, which will
guide the user through the steps required to install the add-in on the user’s computer.
Search JabSto ::

Custom Search