ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How to stop CommandButtons being deleted as pictures in code?? (https://www.excelbanter.com/excel-programming/370405-how-stop-commandbuttons-being-deleted-pictures-code.html)

Corey

How to stop CommandButtons being deleted as pictures in code??
 
ActiveSheet.Pictures.Delete

I need to modify the above so that it does not include all the commandbuttons, but how?
I need commandbuttons and not a forms - button as the code needs to be exportable to other files and to take the code with them.

Any ideas?
Corey....

Norman Jones

How to stop CommandButtons being deleted as pictures in code??
 
Hi Corey,

Try:

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

For Each SHP In ActiveSheet.Shapes
With SHP
If .Type = msoPicture Then
.Delete
End If
End With
Next SHP
End Sub
'<<=============



---
Regards,
Norman



"Corey" wrote in message
...
ActiveSheet.Pictures.Delete

I need to modify the above so that it does not include all the
commandbuttons, but how?
I need commandbuttons and not a forms - button as the code needs to be
exportable to other files and to take the code with them.

Any ideas?
Corey....



Corey

How to stop CommandButtons being deleted as pictures in code??
 
thanks Norman.
Perfect
"Norman Jones" wrote in message
...
Hi Corey,

Try:

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

For Each SHP In ActiveSheet.Shapes
With SHP
If .Type = msoPicture Then
.Delete
End If
End With
Next SHP
End Sub
'<<=============



---
Regards,
Norman



"Corey" wrote in message
...
ActiveSheet.Pictures.Delete

I need to modify the above so that it does not include all the
commandbuttons, but how?
I need commandbuttons and not a forms - button as the code needs to be
exportable to other files and to take the code with them.

Any ideas?
Corey....




Norman Jones

How to stop CommandButtons being deleted as pictures in code??
 
Hi Corey,

Additionally, see Ron de Bruin's discussion at:

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

See particularly the section entitled: 'Delete only specific shapes'


---
Regards,
Norman





Corey

How to stop CommandButtons being deleted as pictures in code??
 
Dim SHP As Shape

For Each SHP In ActiveSheet.Shapes <======== How can i change this to
ALL Sheets in workbook ?
With SHP
If .Type = msoPicture Then
.Delete
End If
End With
Next SHP

Corey....
"Norman Jones" wrote in message
...
Hi Corey,

Additionally, see Ron de Bruin's discussion at:

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

See particularly the section entitled: 'Delete only specific shapes'


---
Regards,
Norman







Norman Jones

How to stop CommandButtons being deleted as pictures in code??
 
Hi Corey,

Try:

'=============
Public Sub Tester()
Dim SH As Worksheet
Dim SHP As Shape

For Each SH In ThisWorkbook.Worksheets
For Each SHP In SH.Shapes
With SHP
If .Type = msoPicture Then
.Delete
End If
End With
Next SHP
Next SH
End Sub
'<<=============


---
Regards,
Norman



"Corey" wrote in message
...
Dim SHP As Shape

For Each SHP In ActiveSheet.Shapes <======== How can i change this to
ALL Sheets in workbook ?
With SHP
If .Type = msoPicture Then
.Delete
End If
End With
Next SHP

Corey....





All times are GMT +1. The time now is 10:56 AM.

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