View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
WhytheQ WhytheQ is offline
external usenet poster
 
Posts: 246
Default Remove buttons from worksheet programmatically

Try this Albert:

'====================
Sub DeleteAllButtons()

Dim mySheet As Worksheet
Dim MyButton As OLEObject

For Each mySheet In ActiveWorkbook.Worksheets

For Each MyButton In mySheet.OLEObjects
If TypeOf MyButton.Object Is MSForms.CommandButton Then
MyButton.Delete
End If
Next MyButton

Next mySheet

End Sub
'====================




On 11 Sep, 12:20, "Albert Browne" wrote:
Hi.

I have a number of worksheets that I copy to a new workbook. These
worksheets have a number of command buttons. I would like to remove these
buttons after copying. Is this possible with VBA?

Thanks.

Albert