在设计模式下显示自定义功能区(shift shift) - 访问2013

时间:2015-10-05 14:58:17

标签: ms-access ribbon

最近我为访问2013数据库创建了一个自定义功能区。在我的旧访问2000数据库中,即使我使用shift(设计器模式 - 因此我可以看到表格等)打开数据库,我总能看到自定义工具栏。

在访问2013中,当我使用shift enter打开它时,我无法看到我自定义创建的功能区(我只能在功能区中看到文件,创建,外部数据和帮助工具),是否可以看到自定义功能区在设计师模式(转开)?

这里有一些额外的信息: 功能区以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>

加载功能区的代码如下:

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

自定义功能区也在access 2013选项中设置: 当前数据库 - &gt;功能区选项 - &gt;名称功能区 - &gt;我的丝带

我是如何在设计师模式中加载自定义功能区的?用按钮或其他东西?

1 个答案:

答案 0 :(得分:0)

我建议在调试模式下避免使用Shift键打开应用程序。在应用程序中设置类似“Debug”标志的东西,使用此标志加载自定义功能区的调试版本(使用startFromScratch =“false”)并绕过,例如,登录屏幕。用于发布更改功能区到生产版本。 另一种方法 - 在使用Shift键启动应用程序后,在表单或宏中使用LoadCustomUI方法加载菜单