Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 29
Default deleting form controls by code

Hello

I' like to USE CODE to delete controls from a worksheet. I hope to use the
code on several sheets.

I used 'Record Macro' to come up with the following, which works well on the
1st sheet ...

Application.CommandBars("Drawing").Visible = True
ActiveSheet.Shape.Range(Array("chbx1", "chbx2", "optbx1")).Select
Selection.Delete
Application.CommandBars("Drawing").Visible = False

The problem is that different sheets have different numbers of controls,
sometimes with different names, so the Array part of the code above crashes.
What code can I use to delete all form controls from a given page?

Thank you
Bri



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default deleting form controls by code

Hi Bri

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


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


"Bri" wrote in message ...
Hello

I' like to USE CODE to delete controls from a worksheet. I hope to use the code on several sheets.

I used 'Record Macro' to come up with the following, which works well on the 1st sheet ...

Application.CommandBars("Drawing").Visible = True
ActiveSheet.Shape.Range(Array("chbx1", "chbx2", "optbx1")).Select
Selection.Delete
Application.CommandBars("Drawing").Visible = False

The problem is that different sheets have different numbers of controls, sometimes with different names, so the Array part of the
code above crashes. What code can I use to delete all form controls from a given page?

Thank you
Bri





  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 29
Default deleting form controls by code

Ron - MOST helpful
Thanks
Bri


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
ActiveX Controls vs Form Controls Alex Excel Discussion (Misc queries) 1 January 11th 06 08:46 AM
Form controls Sheldon Excel Programming 2 October 22nd 04 01:20 PM
about more controls of a form EXCEL$B!!(BNEWS Excel Programming 0 October 1st 04 08:59 AM
Deleting worksheets containing ActiveX controls Alex[_24_] Excel Programming 4 May 10th 04 08:51 AM
Deleting ActiveX Controls Ron[_12_] Excel Programming 1 October 16th 03 03:42 PM


All times are GMT +1. The time now is 10:26 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"