You are here:   Home > Access - Ribbons > Load Ribbons Into The Database > ... Loading ribbons using any ADP table

... Loading ribbons using any ADP table

 

Create a new ADP table named e.g.:"Ribbons" with following fields:

ADP Table 

Enter a unique "RibbonName" and the appropriate XML in field "RibbonXML".

 

In a standard module create the new function "LoadRibbons":

Public Function LoadRibbons()
'Load ribbons into the database
On Error GoTo Error1
    Dim strSQL As String
    Dim cnn As ADODB.Connection
    Dim rst As ADODB.Recordset
    Set cnn = New ADODB.Connection
    Set rst = New ADODB.Recordset
    strSQL = "SELECT * FROM [Ribbons]; "
    ' [Ribbons] has to be replaced by your table name.
   
    cnn.Open CurrentProject.Connection
    rst.Open strSQL, cnn, adOpenDynamic, adLockOptimistic
    Do Until rst.EOF
        Application.LoadCustomUI _
        rst("RibbonName").Value, rst("RibbonXml").Value
        strRibbon = rst("RibbonName").Value
        rst.MoveNext
    Loop
    rst.Close
    Set rst = Nothing
    cnn.Close
    Set cnn = Nothing
Error1_Exit:
    On Error Resume Next
    rs.Close
    Set rs = Nothing
    Set db = Nothing
    Exit Function
Error1:
    Select Case Err
        Case 32609
        ' Ribbon already loaded
    Case Else
        MsgBox "Error: " & Err.Number & vbCrLf & _
               Err.description, vbCritical, _
               "Error", Err.HelpFile, Err.HelpContext
    End Select
    Resume Error1_Exit
End Function

Create a macro named "AutoExec" which will be run when you open the database:

Action:

RunCode

Function Name:

LoadRibbons()

Autoexec-Makro

Re-start the database.

Assign the ribbon for this database:

Ribbon Options"Office Button" / Button "Access-Options" / "Current Database" / "Ribbon and Toolbar Options" / "Ribbon Name:" select the ribbon that should be loaded when you open the database.

 

After another re-start of the database your ribbon will be displayed.

 

 

 

Last Updates:

19.01.2013
Update Downloads for "Trusted Locations" - Versions for Office 2013 ...


29.08.2012
Revised versions for IDBE RibbonCreator2010 (Version 1.1014a) ...

07.08.2012
Update Group Attributes and Callbacks. ...

02.08.2012
New Access FAQ added. New Download added. ...

 

Last update:
April 07, 2013, 22:24