ShowToolbar 宏操作

适用于:Access 2013、Office 2013

可以使用 ShowToolbar 操作显示或隐藏“加载项”选项卡上的一组命令。

注意

  • [!注释] ShowToolbar 操作不影响快捷菜单。
  • 如果数据库不受信任,则不允许执行此操作。

Setting

ShowToolbar 操作具有下列参数。

操作参数

说明

工具栏名称

“加载项”选项卡上要显示或隐藏的命令组的名称。 “宏生成器”窗格“操作参数”部分的“工具栏名称”框会显示此操作可以影响到的所有可用的组。 这是一个必选参数。 如果在类库数据库中运行包含 ShowToolbar 操作的宏,Access 将先在该类库数据库中查找具有此名称的组,然后再在当前数据库中查找。

Show

指定是显示还是隐藏组以及在哪些视图中显示或隐藏组。 默认值为 “是 ” () 显示组。 你可以选择 “是 ”以随时显示组, 选择“在适当位置 ”仅当相应的窗体或报表处于活动状态时显示组,或选择 “否 ”,随时隐藏组。

备注

可以在包含条件表达式的宏中使用此操作,以便根据某些条件来显示或隐藏组。

If you want to show a particular group on just one form or report, you can set the OnActivate property of the form or report to the name of a macro that contains a ShowToolbar action to show the group. Then set the OnDeactivate property of the form or report to the name of a macro that contains a ShowToolbar action to hide the group.

The built-in toolbars are not available to display or hide by using this action if you set the AllowBuiltInToolbars property to False (0) in a Visual Basic for Applications (VBA) module, or if you set the Allow Built-in Toolbars option to False in VBA by using the SetOption method.

要在 VBA 模块中运行 ShowToolbar 操作,请使用 DoCmd 对象的 ShowToolbar 方法。