Okay - "only" / primary the Ribbon UI handling.
The used objectname is still visible - but you can use a certain technique to "not" expose the function names (at least)
But once the tlb is linked in VBA the class "RibbonMenu" is still visible - so you goal is not fully achieved.
With the below technique you can hide the functions and once you use a certain project prefix .. the names are unique and you can run multiple projects with the same technique.
The TLB will just contain:
coclass RibbonMenu
{
[default] dispinterface _RibbonMenu;
dispinterface _Object;
dispinterface _IDTExtensibility2;
dispinterface IRibbonExtensibility;
};
Within your core AddinClass .. you can:
Public Class AddInEvents
Implements IExcelAddIn
..
Public Sub AutoOpen() Implements IExcelAddIn.AutoOpen
ComServer.DllRegisterServer()
..
' Ribbon setup
Menu.MenuHandler = New RibbonMenu
..
End Sub
Public Sub AutoClose() Implements IExcelAddIn.AutoClose
..
Menu.MenuHandler = Nothing
..
ComServer.DllUnregisterServer()
End Sub
End Class
Now you need a combined class (which contains at least):
Friend Module Menu
Public RibbonUI As CustomUI.IRibbonUI
Public MenuHandler As RibbonMenu
'... optional add here functions in order to all internal functions to refesh selected controls
End Module
<ComVisible(True)>
Public Class RibbonMenu
Inherits CustomUI.ExcelRibbon
Private Const gAppId As String = "2DF4D6A2DBA2"
Public ReadOnly Property AppId() As String
Get
Return gAppId
End Get
End Property
Public Overrides Function GetCustomUI(RibbonID As String) As String
Dim sUI As String =
"<?xml version='1.0' encoding='utf-8'?>" + vbCrLf +
"<customUI xmlns='
http://schemas.microsoft.com/office/2009/07/customui' onLoad='Ribbon_axCore_" & gAppId & "_OnRibbonLoad'>" + vbCrLf +
" <ribbon startFromScratch='false'>" + vbCrLf + .. <- define here your Ribbon UI
Return sUI
End Function
Public Sub Ribbon_axCore_2DF4D6A2DBA2_OnRibbonLoad(oRibbon As CustomUI.IRibbonUI)
Menu.RibbonUI = oRibbon
End Sub
'.. here all remaining needed Ribbon Functions like _OnAction, _GetContent or GetImage (from a included ResImage)
'#Disable Warning BC42105
Public Function Ribbon_axCore_2DF4D6A2DBA2_GetImage(control As CustomUI.IRibbonControl)
Dim ResImage As String = ExtractResImage(control.Tag, DefaultResName)
Try
Dim obj As Object = My.Resources.ResourceManager.GetObject(ResImage, My.Resources.Culture)
If obj Is Nothing Then obj = My.Resources.ResourceManager.GetObject(DefaultResName, My.Resources.Culture)
If obj IsNot Nothing Then
Return CType(obj, System.Drawing.Bitmap)
End If
Catch ex As Exception
End Try
Return Nothing
End Function
'#Enable Warning BC42105
End Class