是否有可能以prevent的MS Access使用自定义功能区时,自动更改选定的带状标签?有可能、带状、自定义、标签

2023-09-08 10:59:55 作者:没有谁比我更清楚你 -

在自定义UI的XML文件是用来在Access中添加几个自定义功能区选项卡,选中的功能区选项卡变回每当窗体关闭的第一个自定义选项卡。

When a custom UI XML file is used to add several custom ribbon tabs in Access, the selected ribbon tab changes back to the first custom tab whenever a form is closed.

我们从编程VBA加载自定义功能区。我创建能重现问题的ACCDB。该文件夹还包括一个包含所述色带定义的XML文件。它必须是在相同的目录中的文件.ACCDB

We load a custom ribbon programatically from VBA. I've create an accdb that reproduces the problem. The folder also includes an XML file that contains the ribbon definition. It must be in the same directory as the .accdb file.

该问题可以很容易地证明:

The problem can easily be demonstrated:

打开数据库RibbonTest.accdb, 使用色带上的按钮切换到TAB2和开放的窗体2和 关闭窗体2。

注意TAB1现在是活动的。

Notice that Tab1 is now active.

当然,在这个小例子分贝这个问题似乎很轻微。但是,我们有一个非常大的项目有许多自定义选项卡,每个都包含大量的团体和按钮。我们的用户发现它非常令人沮丧确实是他们保持每次关闭窗体时在功能区中失去自己的位置。

Of course, in this small example db this problem seems very minor. However, we have a very large project with many custom tabs, each containing numerous groups and buttons. Our users are finding it very frustrating indeed that they keep losing their place on the ribbon every time they close a form.

我们已经研究了一个解决办法,我们编程存储选定的选项卡,并恢复它的时候,我们认为我们需要。然而,可以证明难以可靠地做到这一点。 (没有自动化这样的功能区的Office API,但这篇文章帮助。)

We have investigated a workaround where we programatically store the selected tab and restore it when we think we need to. However, it is proving difficult to do this reliably. (There isn't an Office API for automating the ribbon like this, but this article helped.)

有没有其他人遇到这个问题?你从自动改变找到了一种方法prevent的标签?

Has anyone else encountered this problem? Have you found a way to prevent the tab from changing automatically?

编辑:看来,这个问题被引入与Office实现2010 SP1修复。 (对不起,没有链接:别以为我可以有两个以上的)问题不在于present在RTM版本。该修补程序列表SP1包括了这一点:Access不激活或用户返回到正确的功能区选项卡为previously打开的数据库对象,当用户返回到该对象。看来,他们已经试图修复使用Form.RibbonName属性(支持上下文色带),但已经打破在这个过程中默认的色带。

It seems that this problem was introduced with a fix implemented in Office 2010 SP1 . (Sorry, no link: don't think I can have more than two.) The problem is not present in the RTM version. The fix list for SP1 includes this: "Access does not activate or return the user to the correct Ribbon tab for a previously opened database object when the user returns to that object." It seems that they've tried to fix use of the Form.RibbonName property (which supports contextual ribbons), but have broken the default ribbon in the process.

推荐答案

这是我偶然发现了一个已经工作对我来说是隐藏使用可见的标记在XML中的第一个标签。我没有测试过了,但我的标准主页选项卡是隐藏的(不知道是否需要一个填充选项卡与否)的副本。在我看来,由于Access不能真正激活隐藏的标签,当你关闭一个形式,它保留在当前选择之一。

Potential Workaround

Something I stumbled across that's been working for me is to hide the first tab in the XML using the visible tag. I haven't tested it much, but I have a copy of the standard Home tab that is hidden (no idea if it needs to be a populated tab or not). It appears to me that since Access can't actually activate the hidden tab when you close a form, it remains on the currently selected one.

我不知道这是修复的Access 2013年或没有,但希望的信息是不是太晚了要使用的人的。

I don't know if this was fixed in Access 2013 or not, but hopefully the info isn't too late to be of use to someone.