使用 VBA 最小化 Office 功能区?

发布于 2024-08-28 21:53:01 字数 158 浏览 4 评论 0原文

我最近没有真正努力搜索,但在过去我已经四处搜索以找出一种使用 VBA 代码最小化功能区的方法。对我来说,我的大多数用户都没有使用 Access 中的功能区,如果我能为他们回收屏幕空间,我会非常高兴。

我知道我可以训练他们将其最小化,但是……好吧……他们是用户,而不是计算机极客。 :-)

I haven't searched real hard recently but in the past I have searched high and low to figure out a way to minimize the ribbon with VBA code. For me, most of my users have no use for the ribbon in Access, I would be very happy if I could reclaim the screen real estate for them.

I know I could train them to minimize it but...well...they are users, not computer geeks. :-)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

人海汹涌 2024-09-04 21:53:01

如果您的数据库设置为在打开时显示特定的表单,则可以将此代码放入表单的打开事件中:

Private Sub Form_Open(Cancel As Integer)
    Call HideRibbon
End Sub

这是 HideRibbon 子项:

Public Sub HideRibbon()
    'Access versions before 2007 did not have ribbon '
    'ignore error: '
    '2094, <App Name> can't find the toolbar 'Ribbon.'
    On Error Resume Next
    DoCmd.ShowToolbar "Ribbon", acToolbarNo
    On Error GoTo 0
End Sub

编辑:我更改了 HideRibbon 子项以消除 出错时继续下一步。它在 Access 2003 和 2007 中实现了我想要的功能。不确定所有早期 Access 版本或未来 Access 版本中 SysCmd(acSysCmdAccessVer) 返回的字符串值。

Public Sub HideRibbon()
    'Access versions before 2007 did not have ribbon '
    If Val(SysCmd(acSysCmdAccessVer)) >= 12 Then
        DoCmd.ShowToolbar "Ribbon", acToolbarNo
    End If
End Sub

If your database is set up to display a particular form when it's opened, you could put this code in the form's open event:

Private Sub Form_Open(Cancel As Integer)
    Call HideRibbon
End Sub

Here is the HideRibbon sub:

Public Sub HideRibbon()
    'Access versions before 2007 did not have ribbon '
    'ignore error: '
    '2094, <App Name> can't find the toolbar 'Ribbon.'
    On Error Resume Next
    DoCmd.ShowToolbar "Ribbon", acToolbarNo
    On Error GoTo 0
End Sub

Edit: I changed the HideRibbon sub to eliminate On Error Resume Next. It does what I want in Access 2003 and 2007. Not sure about the string value returned by SysCmd(acSysCmdAccessVer) in all the earlier Access versions, or future Access versions.

Public Sub HideRibbon()
    'Access versions before 2007 did not have ribbon '
    If Val(SysCmd(acSysCmdAccessVer)) >= 12 Then
        DoCmd.ShowToolbar "Ribbon", acToolbarNo
    End If
End Sub
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文