Loading a table programmatically with the LoadCustumUI function doesn’t always
work; if the table is not automatically loaded, you can load it manually, as described
earlier in this chapter (see Figure 15.8).
The basExtrasRibbon module also contains several callback procedures, which are the same as
those in the standard Extras 2007.accda add-in, except for the ByVal control As
IRibbonControlargument (plus one new procedure, for backing up a back end database).
How did I find the GUID for Office 12’s object library? I found the path from the
References dialog, then searched for it in the Registry, using the RegEdit utility; the
GUID is on the line above the one listing the path.
Public Function LoadRibbons()
‘Must be a function so it can be run from USysRegInfo table.
On Error Resume Next
Dim i As Integer
Dim strRibbonName As String
Dim strRibbonXML As String
Set dbsCode = CodeDb
Set dbsCalling = CurrentDb
Add a reference to the Office 12 object library (if there isn’t one already).
Application.References.AddFromGuid _
“{000C0126-0000-0000-C000-000000000046}”, 1, 0
Copy the USysRibbons table to the calling database, after deleting any existing table of that name,
if there is one.
Set dbsCalling = CurrentDb
strCallingDb = CurrentDb.Name
Set tdfsCalling = dbsCalling.TableDefs
strTable = “USysRibbons”
Set tdfCalling = tdfsCalling(strTable)
DoCmd.SetWarnings False
If tdfCalling Is Nothing Then
Debug.Print strTable & “ not found; about to copy it”
DoCmd.CopyObject destinationdatabase:=strCallingDb, _
newname:=strTable, _
sourceobjectType:=acTable, _
sourceobjectname:=strTable
Else
TIPTIP
CAUTION CAUTION
Customizing the Ribbon with XML in Access Databases and Add-ins 15