Export (0) Print
Expand All
Cut
Run
Expand Minimize

OnAddInsUpdate Method

Visual Studio .NET 2003

Occurs when an Add-in is loaded or unloaded in the environment.

[Visual Basic .NET]
Public Sub OnAddInsUpdate( _
   ByVal custom() As Variant _
) 
[Visual Basic 6]
Sub OnAddInsUpdate( _
   ByVal custom() As Variant _
) 
[C++]
HRESULT __stdcall OnAddInsUpdate(
   SAFEARRAY** custom
);
[C#]
void OnAddInsUpdate(
   object[] custom
);
[JScript .NET]
public function OnAddInsUpdate(
   custom : Object[]
)

Parameters

custom
An array of Variants that you can use to provide additional data.

Remarks

OnAddInsUpdate is a method that, when its host interface is implemented, acts as an event that takes place when a change occurs to the list of Add-ins in the Add-In Manager, such as when an Add-in is loaded or unloaded. Add-ins can be loaded and unloaded in the Add-In Manager dialog box, or through other methods, such as a toolbar button or named command.

The OnAddInsUpdate event occurs in any other loaded Add-ins. For example, if Add-ins A and B are both currently loaded, and then Add-in C is loaded, the OnAddInsUpdate event occurs in Add-ins A and B. If C is unloaded, the OnAddInsUpdate event occurs again in Add-ins A and B.

If you have an Add-in that depends on another Add-in, you can use the OnAddInsUpdate event procedure in the dependent Add-in to determine whether the other Add-in has been loaded or unloaded.

Note   The OnStartupComplete, OnBeginShutdown, and OnAddInsUpdate event procedures each provide only a single argument, the Custom() argument, which is an empty array of Variant values. This argument is ignored in Add-ins for Office 2000 applications.

Example

Note that this code works only in an Add-In project, not in macros.

Imports Microsoft.Office.Core
imports Extensibility
imports System.Runtime.InteropServices
Imports EnvDTE

<GuidAttribute("B25D9733-A1B2-420D-8F6B-478E2B051C83"), ProgIdAttribute("MyAddin1.Connect")> _
Public Class Connect
   Implements Extensibility.IDTExtensibility2

   Dim applicationObject As EnvDTE.DTE
   Dim addInInstance as EnvDTE.AddIn
   
   Public Sub OnAddInsUpdate(ByRef custom As System.Array) Implements Extensibility.IDTExtensibility2.OnAddInsUpdate
      Msgbox("Add-In update event occuring.")
   End Sub
End Class

See Also

OnBeginShutdown Method | OnConnection Method | OnDisconnection Method | OnStartupComplete Method

Applies To: IDTExtensibility2 Interface

Show:
© 2014 Microsoft