S
Shahzad Godil
I am using this code to disable delete button action in my .net application.
But it is working anyway. Please suggest.
Thanks
Shahzad Godil
Public Sub SetAccelTables(ByVal CurrentDocument As VSDocument)
Dim vsoUIObject As UIObject
Dim vsoAccelTable As AccelTable
Dim vsoAccelItems As AccelItems
Dim vsoAccelItem As AccelItem
Dim intCounter As Integer
'Retrieve the UIObject object for the copy of the built-in menus.
vsoUIObject = CurrentDocument.VisioDoc.Application.BuiltInMenus()
'Set vsoAccelTable to the drawing menu set.
vsoAccelTable =
vsoUIObject.AccelTables.ItemAtID(VisUIObjSets.visUIObjSetDrawing)
'Retrieve the accelerator items collection.
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
vsoAccelItem = vsoAccelItems.Item(intCounter)
If vsoAccelItem.CmdNum = VisUICmds.visCmdUFEditClear Then
Debug.Write(vsoAccelItem.Key())
'Delete the accelerator.
Exit For
End If
Next intCounter
vsoAccelItem.Delete()
'Tell Visio to use the new UI.
CurrentDocument.VisioDoc.Application.SetCustomMenus(vsoUIObject)
CurrentDocument.VisioDoc.SetCustomMenus(vsoUIObject)
CurrentDocument.VisioDoc.Application.BuiltInMenus.UpdateUI()
End Sub
But it is working anyway. Please suggest.
Thanks
Shahzad Godil
Public Sub SetAccelTables(ByVal CurrentDocument As VSDocument)
Dim vsoUIObject As UIObject
Dim vsoAccelTable As AccelTable
Dim vsoAccelItems As AccelItems
Dim vsoAccelItem As AccelItem
Dim intCounter As Integer
'Retrieve the UIObject object for the copy of the built-in menus.
vsoUIObject = CurrentDocument.VisioDoc.Application.BuiltInMenus()
'Set vsoAccelTable to the drawing menu set.
vsoAccelTable =
vsoUIObject.AccelTables.ItemAtID(VisUIObjSets.visUIObjSetDrawing)
'Retrieve the accelerator items collection.
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
vsoAccelItem = vsoAccelItems.Item(intCounter)
If vsoAccelItem.CmdNum = VisUICmds.visCmdUFEditClear Then
Debug.Write(vsoAccelItem.Key())
'Delete the accelerator.
Exit For
End If
Next intCounter
vsoAccelItem.Delete()
'Tell Visio to use the new UI.
CurrentDocument.VisioDoc.Application.SetCustomMenus(vsoUIObject)
CurrentDocument.VisioDoc.SetCustomMenus(vsoUIObject)
CurrentDocument.VisioDoc.Application.BuiltInMenus.UpdateUI()
End Sub