问题描述
我正在寻找一种可靠的方法来在 OnLoad() 事件期间最小化默认的 MSAccess 工具栏功能区.
I'm looking for a reliable method to minimize the default MSAccess Toolbar Ribbon during the OnLoad() event.
我意识到可以完全隐藏工具栏,但这并不是我想要做的 - 我只想最小化功能区:
I realize can totally HIDE the toolbar, but that's not exactly what I am looking to do - I just want to minimize the ribbon:
DoCmd.ShowToolbar "Ribbon", acToolbarNo 'Hides the full toolbar
DoCmd.ShowToolbar "Ribbon", acToolbarYes 'Show
我尝试了几种方法,但结果喜忧参半:
I've tried a couple approaches, with mixed success:
In Access 2010 &2013 (VB7):
In Access 2010 & 2013 (VB7):
CommandBars.ExecuteMso "MinimizeRibbon"
早期版本:
SendKeys "^{F1}", False
这两种方法似乎都作为会话之间的切换操作.有没有办法确定当前状态,然后应用适当的代码?
Both of these approaches appear to operate as a TOGGLE between sessions. Is there a method to determine the current state and then apply the appropriate code?
我有访问权限的用户:2007、2010、2013
I have users with Access: 2007, 2010, 2013
感谢您的建议!
标记
推荐答案
在 MSDN 上查看此答案.他分享了几种不同的实现方式,包括示例数据库.
Check out this answer on MSDN. He shares a few different ways to go about it, including a sample database.
E.G.在 Access 2010 中,您可以通过以下方式更改功能区状态:
E.G. In Access 2010 you can change the Ribbon state with:
CommandBars.ExecuteMso "MinimizeRibbon"
他链接到:
http://www.accessribbon.de/en/index.php?常见问题解答:19
http://www.accessribbon.de/en/index.php?下载次数:15
根据使用的访问权限,您可能可以使用不同的功能.
Based on what access is being used, you could use different functions, perhaps.
从 - http://windowssecrets.com/forums/showthread.php/142262-How-to-find-Access-version-in-code:
Public Function AccessVersionID() As String
Select Case SysCmd(acSysCmdAccessVer)
Case 7: AccessVersionID = "95"
Case 8: AccessVersionID = "97"
Case 9: AccessVersionID = "2000"
Case 10: AccessVersionID = "2002"
Case 11: AccessVersionID = "2003"
Case 12: AccessVersionID = "2007"
Case 13: AccessVersionID = "Pirated!"
Case 14: AccessVersionID = "2010"
Case 15: AccessVersionID = "2013"
Case Else: AccessVersionID = "Unknown"
End Select
End Function 'AccessVersionID()
这篇关于MSAccess - 最小化工具栏功能区 OnLoad()?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!