Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 30
Default Need VBA to remove command buttons

I used the macro recorder to record a macro to remove command buttons from a
worksheet. The routine gets hung up and says I don't have permission to
delete the buttons. I realized that when I was recording the macro I first
had to put the sheet into design mode and that step was not recorded by the
macro recorder. What is the VBA command to turn on design mode?

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,588
Default Need VBA to remove command buttons

Try:

activesheet.oleobjects("btn1").delete

Tim



"Bill_S" wrote in message
...
I used the macro recorder to record a macro to remove command buttons from
a
worksheet. The routine gets hung up and says I don't have permission to
delete the buttons. I realized that when I was recording the macro I
first
had to put the sheet into design mode and that step was not recorded by
the
macro recorder. What is the VBA command to turn on design mode?



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 396
Default Need VBA to remove command buttons

Hello Bill S, you can try the following as well.

ActiveSheet.Shapes("CommandButton1").Delete

You must put in the name of the button if you changed it, the default
name is CommandButton1, CommandButton2 etc....


Best regards,

Les Stout

*** Sent via Developersdex http://www.developersdex.com ***
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,124
Default Need VBA to remove command buttons

Or, if you don't know the name and you want to delete ALL shapes on a
particular sheet.

Sub deleteALLshapes()
For Each sh In Sheets("sheet3").Shapes
sh.Delete
Next sh
End Sub

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Les Stout" wrote in message
...
Hello Bill S, you can try the following as well.

ActiveSheet.Shapes("CommandButton1").Delete

You must put in the name of the button if you changed it, the default
name is CommandButton1, CommandButton2 etc....


Best regards,

Les Stout

*** Sent via Developersdex
http://www.developersdex.com ***

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 175
Default Need VBA to remove command buttons

Also, make sure that protection is turned off. You can turn it back on after
the delete takes place.

--
Regards,
John


"Don Guillett" wrote:

Or, if you don't know the name and you want to delete ALL shapes on a
particular sheet.

Sub deleteALLshapes()
For Each sh In Sheets("sheet3").Shapes
sh.Delete
Next sh
End Sub

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Les Stout" wrote in message
...
Hello Bill S, you can try the following as well.

ActiveSheet.Shapes("CommandButton1").Delete

You must put in the name of the button if you changed it, the default
name is CommandButton1, CommandButton2 etc....


Best regards,

Les Stout

*** Sent via Developersdex
http://www.developersdex.com ***




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
Command Buttons Command Button Calculations Excel Discussion (Misc queries) 4 May 25th 10 06:51 PM
Command Buttons msals22 Excel Discussion (Misc queries) 1 June 22nd 06 01:33 AM
command buttons kevatt[_22_] Excel Programming 3 March 19th 06 02:31 PM
Command buttons Anna B Excel Programming 6 February 24th 06 06:30 PM
Control Buttons vs. Command Buttons Robert Gibson Excel Programming 1 October 13th 03 04:33 PM


All times are GMT +1. The time now is 06:12 PM.

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"