Pages

Tuesday, April 17, 2007

Deleting Custom Office Menus and Toolbars

Deleting Custom Office Menus and Toolbars

Function delete_Control_from_ToolsMenu(ByVal sControlName As String)

' ---------------------------------------------------------------
' Written By Shanmuga Sundara Raman for http://vbadud.blogspot.com
' ---------------------------------------------------------------

On Error GoTo DisplayErr

Dim ctlMenu As CommandBarControl
Dim ctlCommand As CommandBarControl

Set ctlMenu = Application.CommandBars.FindControl(ID:=30007)

If ctlMenu Is Nothing Then Exit Function

Set ctlCommand = ctlMenu.Controls(sControlName)

If Not ctlCommand Is Nothing Then ctlCommand.Delete

DisplayErr:
If Err <> 0 Then
MsgBox Err.Description
Err.Clear
End If

End Function

Creating Custom Office Menus and Toolbars, Programming Microsoft Office Command Bars, CommandBars Property, Creating an Excel Add-in, Disable command bars and controls, Change the availability for the CommandBars using VBA, Delete/ hide a custom command bar

No comments:

Post a Comment