Search code examples
ms-accessribbon

Show custom ribbon in design mode (shift open) - access 2013


Recently I created a custom ribbon for my access 2013 database. In my old access 2000 database I could always see the custom toolbars even if I opened the database with shift (designer mode - so I can see the tables, etc.).

In access 2013 however, I cant see my custom created ribbon when I open it with shift enter (I can only see the file, create, external data and help tools in the ribbon), is it possible to see the custom ribbon in designer mode (shift open)?

Here some additional information: The ribbon is build in XML:

<customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui" onLoad="OnMainRibbonLoad" >
    <ribbon startFromScratch="true">
        <tabs>
            <tab id="tabBogus" label="Bogus" visible="false">

                <group id="oPrint" label="Print- en pagina instellingen" >    
                    <button idMso="PrintDialogAccess" size="large" label="Afdrukken" imageMso="PrintDialogAccess" getEnabled="MyEnabled" />
                    <button idMso="PageSetupDialog" size="large" label="Pagina instellingen" getEnabled="MyEnabled"  />
                    <control idMso="FilePrintPreview" label="Print Preview" getEnabled="MyEnabled"/>
                    <button id="PrintKies" label="Standaard printer" screentip="Standaard printer" supertip="Stel de standaard printer in." imageMso="FilePrintQuick" onAction="ribbonOpenForm" getEnabled="MyEnabled" tag="PrinterKiezen"/>
                </group>
</tab>

The code to load the ribbon is as follows:

Private m_ribbon As IRibbonUI

Private Declare Function apiGetUserName Lib "advapi32.dll" Alias _
    "GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long

Sub OnMainRibbonLoad(OPSRibbon As IRibbonUI)
  'handles the OnLoad callback of the customUI element
  'and saves the IRibbonUI object reference to m_ribbon


  Set m_ribbon = OPSRibbon
end sub






Public Property Get MainRibbon() As IRibbonUI
      'global property that re-exposes the ribbon system-wide
      'so consumers can call the IRibbonUI.Invalidate method as required

      Set MainRibbon = m_ribbon

    End Property

Private Sub Form_Current()
  'consumes the global object reference to the ribbon
  'calls its invalidate method
  'and while rebuilding the ribbon your ToolEnabled() method will be called
  'to enable, or not, your control

  MainRibbon.Invalidate


End Sub

The custom ribbon is also set in the access 2013 options: Current database --> Ribbon options -->Name Ribbon --> my ribbon

Any clue how I can load the custom ribbon in designer mode as well? With a button or something perhaps?


Solution

  • I would recommend avoid using Shift key for opening application in debug mode. Set something like “Debug” flag in the application, with this flag load debug version of custom ribbon (with startFromScratch="false") and bypass, for instance, logon screen. For release change ribbon to production version. The other way – use LoadCustomUI method on form or in macro for loading your menu after starting the application with Shift key