In the OnConnectionmethod, modify the rows that set the application (Access) and add-in vari-
ables as follows:
appAccess = DirectCast(application, _
Microsoft.Office.Interop.Access.Application)
addInInstance = DirectCast(addInInst, _
Microsoft.Office.Core.COMAddIn)
Next, modify the two lines that set the Access and add-in variables as follows:
appAccess = DirectCast(application, Access.Application)
addInInstance = DirectCast(application, Core.COMAddIn)
Add another Implementsstatement to the Connect class as follows:
Implements Extensibility.IDTExtensibility2
Implements IRibbonExtensibility
If all this manual modification of the Shared add-in code is getting tedious, hopefully
the next version (v. 3) of VSTO will include an Access template that will eliminate most
of the hand-coding for support of Access Shared add-ins and the Ribbon.
After adding the Implements IRibbonExtensibilityline, a new function stub should
appear in the Connect class module, GetCustomUI.
If you don’t see the function stub, try doing a Save All. If it still doesn’t appear, just type
in the whole function.
Add a line of code to this function, as listed next:
Public Function GetCustomUI(ByVal RibbonID As String) As String _
Implements Microsoft.Office.Core.IRibbonExtensibility.GetCustomUI
Return My.Resources.Ribbon
End Function
Finally, open the Assembly.vb class from the Solution Explorer and add information about the add-
in (you don’t have to fill in all the information), as shown in Figure 16.18.
This completes the general changes to the Connect class module; now you need to add code for
your add-in’s specific functionality.
NOTENOTE
NOTENOTE
Part III Adding More Functionality to Office