Removing Buttons

S

Steven Stadelhofer

Dave,

Not sure if a new post will help or not - but I wanted to
also add that some of the error messages from your macro
were 'out of memory'. But when I returned to the
spreadsheet I noticed the formula line for the button read
=EMBED("FORMS.HTML:Submitbutton.1","")

and the button was surrounded by the 4 little circles and
I was able to delete one button -- but could not repeat
the process.

Steve
 
D

Dave Peterson

It sounds like there's too many shapes to select all at once.

You could try this version (I moved the .shapes.selectall within the "on error
resume next".)

So if it fails, it should fail without a message. Then it just tries to delete
the remaining shapes one at at time.

Option Explicit
Sub testme2()

Dim iCtr As Long

With ActiveSheet
On Error Resume Next
.Shapes.SelectAll
Selection.Delete
On Error GoTo 0

For iCtr = .Shapes.Count To 1 Step -1
.Shapes(iCtr).Delete
Next iCtr

End With
End Sub

====
But I think that this is all you'd really need:

Option Explicit
Sub testme3()
Dim iCtr As Long
With ActiveSheet
For iCtr = .Shapes.Count To 1 Step -1
.Shapes(iCtr).Delete
Next iCtr
End With
End Sub


Since we know it won't select all the shapes without an error.
 
G

Guest

Thanks Dave - >Sub testme3() seemed to work fine.
Steve
-----Original Message-----
It sounds like there's too many shapes to select all at once.

You could try this version (I moved
the .shapes.selectall within the "on error
 
Top