ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Deleting ActiveX control??? (https://www.excelbanter.com/excel-programming/354267-deleting-activex-control.html)

Dr.Ile[_11_]

Deleting ActiveX control???
 

Hello?

I have a problem with deleting ActiveX CommandButton control. Actualy I
don't want to delete them. Here is an example:

1) First I draw CommandButton control from Control Toolbox and then
assign him a macro...
2) Then I draw a few drawing objects (Line, Rectangle)...
3) Then I write a procedure where I want to delete this drawing objects
(Line, Rectangle) with

...
Worksheets(1).Shapes.SelectAll
Selection.Delete
...

4) Now I run this procedure which delete all drawing objects (Line,
Rectangle) and also CommandButton control.

Can I lock or do something else to prevent deleting CommandButton.

Thank you


--
Dr.Ile
------------------------------------------------------------------------
Dr.Ile's Profile: http://www.excelforum.com/member.php...o&userid=15975
View this thread: http://www.excelforum.com/showthread...hreadid=516122


Norman Jones

Deleting ActiveX control???
 
Hi Dr. Ile,

Try:

'=============
Public Sub Tester002()
Dim SHP As Shape

For Each SHP In ActiveSheet.Shapes
If Not SHP.Type = 12 Then
SHP.Delete
End If
Next SHP

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

---
Regards,
Norman


"Dr.Ile" wrote in
message ...

Hello?

I have a problem with deleting ActiveX CommandButton control. Actualy I
don't want to delete them. Here is an example:

1) First I draw CommandButton control from Control Toolbox and then
assign him a macro...
2) Then I draw a few drawing objects (Line, Rectangle)...
3) Then I write a procedure where I want to delete this drawing objects
(Line, Rectangle) with

..
Worksheets(1).Shapes.SelectAll
Selection.Delete
..

4) Now I run this procedure which delete all drawing objects (Line,
Rectangle) and also CommandButton control.

Can I lock or do something else to prevent deleting CommandButton.

Thank you


--
Dr.Ile
------------------------------------------------------------------------
Dr.Ile's Profile:
http://www.excelforum.com/member.php...o&userid=15975
View this thread: http://www.excelforum.com/showthread...hreadid=516122




Dr.Ile[_12_]

Deleting ActiveX control???
 

It's working!

Thank you Norman

Regards


--
Dr.Ile
------------------------------------------------------------------------
Dr.Ile's Profile: http://www.excelforum.com/member.php...o&userid=15975
View this thread: http://www.excelforum.com/showthread...hreadid=516122



All times are GMT +1. The time now is 03:33 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com