A new VB6 VSTA v 2 sample is available for download.
Below is from the READ ME.doc included in the sample:
There are many ways to integrate VSTA v 2.0 with a VB6 application. This sample demonstrates an advanced integration option (with seamless non-destructive debugging but no macro management) which closely follows the integration code from the SDK samples.
A COM visible library, VSTA2_Integration, is referenced by the VB6 host application, MyAppVB6. The VSTA2_Integration library exposes the classes VSTARunTimeIntegration and VstaDesignTimeIntegration. The VB6 host first creates and connects to its VSTARunTimeIntegration instance passing in the object to be used as an entry point (see definition below) for add-ins through the VSTARunTimeIntegration.Connect method. Then the VB6 host creates and connects to its VSTADesignTimeIntegration instance passing in the VSTARunTimeIntegration instance through the VSTADesignTimeIntegration.Connect method.
This host object (passed in through the VSTARunTimeIntegration.Connect method) is stored in the internal VSTA2_Integration.HostItemProvider (see definition below) which is passed into the add-ins through the VSTA pipeline. Once the host object is passed through the pipeline, it is stored in the add-in in a hidden code file and accessed through “Me” or “Me.Application” (see section on templates below).
The VSTARunTimeIntegration.Connect method makes calls to load add-ins and the VSTARunTimeIntegration.Disconnect method makes calls to unload add-ins. The VB6 host calls the VSTARunTimeIntegration.Connect method on form load, and VSTARunTimeIntegration.Disconnect on form unload. This can easily be changed so that add-ins can be loaded and unloaded by selecting a button on the host.
The DesignTimeIntegration.Connect method takes in and stores the VSTARunTimeIntegration instance and prepares for IDE management. The DesignTimeIntegration.ShowIDE method displays the IDE with a new or existing VSTA project open. The DesignTimeIntegration.Disconnect method disposes of the IDE. The VB6 host calls the DesignTimeIntegration.Connect on form load and the DesignTimeIntegration.Disconnect on form unload. It is not advisable to change this. The ShowIDE method is called through a button on the VB6 host.
This sample does not use a proxy or HostTypeMapProvider, instead a “proxy shim" is included in the add-in to provide a MyAppVB6 entry point. This class is defined in the hidden AppAddIn.designer2.xx file included with the project templates.
Two sets of templates are included with this sample. The “MyAppVB6_VSTA2_Template_Robust.zip” templates allow the add-in to access the host object through “Me” or “this”. The “MyAppVB6_VSTA2_Template.zip” templates allow the add-in to access the host object through “Me.Application” or “this.Application”. For the robust templates, the hidden file AppAddIn.designer2.xx contains code which re-implements/exposes some or all of the entry point type from the VB6 host. The only benefit to this additional code is it allows the host object to be accessed more directly through “Me” or “this” instead less directly through “Me.Application” or “this.Application”. Which type of template to use is a design decision.