UIObject.AccelTables 属性 (Visio)

返回 UIObject 对象的 AccelTables 集合。 此为只读属性。

语法

expressionAccelTables

表达 一个代表 UIObject 对象的变量。

返回值

AccelTables

备注

注意

从 Visio 2010 开始,Microsoft Office Fluent 用户界面 (UI) 替换了以前的分层菜单、工具栏和任务窗格系统。 用于在以前版本的 Visio 中自定义用户界面的 VBA 对象和成员在 Visio 中仍可用,但它们的功能不同。

如果 UIObject 对象代表菜单项和加速键(例如,如果使用 Application 对象的 BuiltInMenus 属性检索 UIObject 对象),则它的 AccelTables 集合代表该 UIObject 对象的加速键表。

要检索特定窗口上下文(例如,绘图窗口)的加速键,请使用 AccelTables 集合的 ItemAtID 属性。 如果窗口上下文不包括加速键,则它没有 AccelTables 集合。 有效的窗口上下文 ID 在 Visio 类型库中的 VisUIObjSets 中声明。

示例

以下 Microsoft Visual Basic for Applications (VBA) 宏显示如何使用 AccelTables 属性删除内置菜单中的加速键。

运行此宏后,要恢复 Microsoft Visio 中的内置菜单,请调用 ThisDocument.ClearCustomMenus 方法。

 
Public Sub AccelTables_Example() 
 
 Dim vsoUIObject As Visio.UIObject 
 Dim vsoAccelTable As Visio.AccelTable 
 Dim vsoAccelItems As Visio.AccelItems 
 Dim vsoAccelItem As Visio.AccelItem 
 Dim intCounter As Integer 
 
 'Retrieve the UIObject object for the copy of the built-in menus. 
 Set vsoUIObject = Visio.Application.BuiltInMenus 
 
 'Set vsoAccelTable to the drawing menu set. 
 Set vsoAccelTable = vsoUIObject.AccelTables.ItemAtID(visUIObjSetDrawing) 
 
 'Retrieve the accelerator items collection. 
 Set vsoAccelItems = vsoAccelTable.AccelItems 
 
 'Retrieve the accelerator item for the Visual Basic Editor. 
 'To do this, we must iterate through the collection 
 'and locate the item we want to manipulate. 
 'The item can be identified either by checking 
 'the CmdNum property or by checking for the specific key. 
 'Because checking for the key requires looking at the Alt, 
 'Control, Shift, and Key properties, it is better to use the 
 'CmdNum property. Because we retrieved the built-in menus, 
 'we know that we can find the accelerator. 
 For intCounter = 0 To vsoAccelItems.Count - 1 
 Set vsoAccelItem = vsoAccelItems.Item(intCounter) 
 If vsoAccelItem.CmdNum = Visio.visCmdToolsRunVBE Then 
 Exit For 
 
 End If 
 Next intCounter 
 
 'Delete the accelerator. 
 vsoAccelItem.Delete 
 
 'Tell Visio to use the new UI. 
 ThisDocument.SetCustomMenus vsoUIObject 
 
End Sub

支持和反馈

有关于 Office VBA 或本文档的疑问或反馈? 请参阅 Office VBA 支持和反馈,获取有关如何接收支持和提供反馈的指南。