Freigeben über


AddInBase.RequestComAddInAutomationService Method

Definition

Returns an object in your add-in that can be used by other solutions.

protected:
 virtual System::Object ^ RequestComAddInAutomationService();
protected virtual object RequestComAddInAutomationService ();
abstract member RequestComAddInAutomationService : unit -> obj
override this.RequestComAddInAutomationService : unit -> obj
Protected Overridable Function RequestComAddInAutomationService () As Object

Returns

An object that you want to expose to other solutions.

Examples

For a code example that demonstrates how to override the RequestComAddInAutomationService method, see Walkthrough: Calling Code in a VSTO Add-in from VBA.

Remarks

Override this method to expose an object in your add-in to other solutions. This includes other add-ins and document-level customizations running in the same application process, VBA code, and external automation code.

The object that you return must be public, it must be visible to COM, and it must expose the IDispatch interface. If the object you return does not meet these requirements, the Visual Studio Tools for Office runtime will throw an InvalidCastException after it calls your implementation.

For more information, see Calling Code in VSTO Add-ins from Other Office Solutions.

Applies to