Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Joe Joe is offline
external usenet poster
 
Posts: 476
Default remove a control from a worksheet

This is the code I used to remove the control, I get runtime error 5 'invalid
procedure call or argument'. Here is the code I used to remove the control:
application.CommandBars("Worksheet Menu Bar").Controls("cmd").Delete

This is the code I used to Add the control:
Set cmd = Application.CommandBars("Worksheet Menu Bar").Controls.Add
With cmd
.BeginGroup = True
.Caption = "myControl"
.BeginGroup = True
.OnAction = "Insert Macro Name Here"
End With

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 486
Default remove a control from a worksheet

Give this a try...

application.CommandBars("Worksheet Menu Bar").Controls("myControl").Delete
--
HTH...

Jim Thomlinson


"joe" wrote:

This is the code I used to remove the control, I get runtime error 5 'invalid
procedure call or argument'. Here is the code I used to remove the control:
application.CommandBars("Worksheet Menu Bar").Controls("cmd").Delete

This is the code I used to Add the control:
Set cmd = Application.CommandBars("Worksheet Menu Bar").Controls.Add
With cmd
.BeginGroup = True
.Caption = "myControl"
.BeginGroup = True
.OnAction = "Insert Macro Name Here"
End With

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
[Excel'03] Cannot Remove System Monitor Control?! Japazo88 Excel Discussion (Misc queries) 2 May 14th 08 02:02 PM
How do you remove a check box (Control) in an Excel spreadsheet? zjan Excel Discussion (Misc queries) 2 April 17th 06 10:41 PM
Can I remove a VBAProject under macro control? Don Wiss Excel Programming 4 August 3rd 05 01:50 AM
Remove all items from an ActiveX control on a sheet quartz[_2_] Excel Programming 4 January 13th 05 06:31 PM
Remove calendar control goss[_3_] Excel Programming 1 September 25th 03 04:32 AM


All times are GMT +1. The time now is 07:45 AM.

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

About Us

"It's about Microsoft Excel"