removing all keyboard accelerators programatically

X

xargon

Hi everyone,

I am trying to remove all keyboard accelerators programatically from the
open Visio document. I tried a function like this but this does not seem
to work :(

Public Sub RemoveAccelerators()
Dim uiObj As Visio.UIObject
Dim accelTableObj As Visio.AccelTable
Dim accelItemsObj As Visio.AccelItems
Dim accelItemObj As Visio.AccelItem
Dim i As Integer

'Retrieve the UIObject object for the copy of
'built-in menus.
Set uiObj = Visio.Application.BuiltInMenus
'Set accelTableObj to the Drawing menu set.
Set accelTableObj = uiObj.AccelTables.ItemAtID(visUIObjSetDrawing)

'Retrieve the accelerator items collection.
Set accelItemsObj = accelTableObj.AccelItems

'Retrieve the accelerator item for the Visual Basic Editor by
iterating
'through the accelerator items collection and locating the item you
want to delete.
For i = accelItemsObj.count - 1 To 0 Step -1
accelItemsObj.Item(i).Delete
Next i

'Tell Visio to use the new custom menus while the document is active.
ThisDocument.SetCustomMenus uiObj

End Sub

Can someone help me. I am wondering what I am doing wrong. if I search for
a particular accelerator in the list and delete it, it works fine. However,
deleting all the accelerators in the list seems to have no effect!

Thanks and cheers!
xargon
 
J

junethesecond

I also found that visCmdToolsRunVBE and very limited items can be deleted
only in the current session. I also wish to know what is wrong in your
code.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top