开发者

Minimize the Office Ribbon with VBA?

开发者 https://www.devze.com 2022-12-27 10:59 出处:网络
I haven\'t searched real ha开发者_高级运维rd 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 th

I haven't searched real ha开发者_高级运维rd 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. :-)


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
0

精彩评论

暂无评论...
验证码 换一张
取 消