PDA

View Full Version : Removing HTMLCheckboxes



garydp
09-21-2009, 11:28 PM
I have an excel program were i paste data into a worksheet and it will format the data into a template. the problem i have is the data that gets pasted in before formating has quiet a few HTMLCheckboxes. these dont get formatted but what i want is to be able to delete these when i clear the form. when i say quiet a few there are nearly 100 at a time. is there a way of deleting these controls without losing the text boxes and command buttons on the same page??

Thanks in advance

Gary

Jan Karel Pieterse
09-22-2009, 12:11 AM
Are these commandbuttons and textboxes from the control toolbox?
If so, put Excel out of design mode (control toolbox, first button) and hit F5, goto, special, objects, delete.

garydp
09-22-2009, 12:36 AM
no they are controls that i have added. i have a command button that clears the pasted data but it doesnt clear the HTMLCheckboxes. the problem i am having is, as the data is being pasted to the worksheet there are hundreds of these HTMLCheckboxes that get pasted too. so i end up with hundreds on top of each other.

so i need to delete them when i press clear with the other data.

garydp
09-22-2009, 10:39 PM
ok just to add to this when i recorded a macro to delete these the code given was

ActiveSheet.Shapes.Range(Array("Control 814", "Control 815", "Control 816", "Control 817")).Select
Selection.Delete

now is there away that i can select all controls on the sheet seeing as i have no idea of the number that it will be given??

rbrhodes
09-24-2009, 01:31 AM
Hi gary

Perhaps loop on the shapes? Since they are HTML controls and they appear to share the name 'Control ###' something like this:



dim shp as shape

for each shp in activesheet.shapes
if left(shp.name, 7) = "Control" then
shp.delete
end if
next shp