Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Disable the Delete Control in the Edit Menu

I'd appreciate any help with the following. While trying to disable the
"Delete" control on the "Edit" CommandBar, I get an "Run-time error '5':
Invalid call or argument" error. However, the code works for the "Delete
Sheet" Control. Any thoughts on what might be going on??? The macro works
if I substitute "11" as the index, but I'm not confident this will be
universal for all computers the macro might be running on if someone's menu
has been customized. Is this a correct assumption? The code being used is:

Sub Disable_RowDelete()

Application.CommandBars("Row").Enabled = False
Application.CommandBars("Edit").Controls("Delete Sheet").Enabled = False
Application.CommandBars("Edit").Controls("Delete") .Enabled = False

End Sub

Sub Enable_RowDelete()

Application.CommandBars("Row").Enabled = True
Application.CommandBars("Edit").Controls("Delete Sheet").Enabled = True
Application.CommandBars("Edit").Controls("Delete") .Enabled = True

End Sub


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Disable the Delete Control in the Edit Menu

Note that it is
Delete...

But use the ID

Sub test()
Application.CommandBars("Worksheet Menu Bar").FindControl _
(ID:=478, Recursive:=True).Enabled = False
End Sub

See
http://www.rondebruin.nl/menuid.htm


--
Regards Ron de Bruin
http://www.rondebruin.nl



"Virtual Hillbilly" wrote in message
...
I'd appreciate any help with the following. While trying to disable the
"Delete" control on the "Edit" CommandBar, I get an "Run-time error '5':
Invalid call or argument" error. However, the code works for the "Delete
Sheet" Control. Any thoughts on what might be going on??? The macro works
if I substitute "11" as the index, but I'm not confident this will be
universal for all computers the macro might be running on if someone's menu
has been customized. Is this a correct assumption? The code being used is:

Sub Disable_RowDelete()

Application.CommandBars("Row").Enabled = False
Application.CommandBars("Edit").Controls("Delete Sheet").Enabled = False
Application.CommandBars("Edit").Controls("Delete") .Enabled = False

End Sub

Sub Enable_RowDelete()

Application.CommandBars("Row").Enabled = True
Application.CommandBars("Edit").Controls("Delete Sheet").Enabled = True
Application.CommandBars("Edit").Controls("Delete") .Enabled = True

End Sub




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
copy command is disable under edit menu Anirban Dutta Excel Discussion (Misc queries) 2 March 22nd 07 10:56 AM
how to disable copy paste buttons from from edit menu excel test Excel Discussion (Misc queries) 2 January 18th 07 05:00 PM
Can't delete or edit control button Steve Excel Discussion (Misc queries) 1 July 15th 05 08:39 PM
Disable Control in Tools Menu Juan Sanchez[_3_] Excel Programming 4 September 30th 04 09:40 PM
Disable the Edit menu command 'Paste Special' George Raymond Excel Programming 4 December 22nd 03 04:44 AM


All times are GMT +1. The time now is 08:46 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"