我最近没有认真搜索过,但过去我一直在搜索高低以找出一种使用 VBA 代码最小化功能区的方法。对我来说,我的大多数用户都没有使用 Access 中的功能区,如果我能为他们收回屏幕空间,我会非常高兴。
我知道我可以训练他们将其最小化,但是……嗯……他们是用户,而不是计算机极客。:-)
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