Professional Documents
Culture Documents
Dim shp As Shape
For Each shp In ActiveSheet.Shapes
shp.Delete
Next shp
End Sub
Dim shp As Shape
For Each shp In ActiveSheet.Shapes
If shp.Type <> msoChart And shp.Type <>
msoComment Then shp.Delete
Next shp
End Sub
Below is a table of all the msoShapeType properties that you can use in your IF statement to
exclude certain shape types from being deleted. You can use the full name or the enumeration
in your code.
Name Enum Type
msoAutoShape 1 AutoShape
msoCallout 2 Callout
msoCanvas 20 Canvas
msoChart 3 Chart
msoComment 4 Comment
msoDiagram 21 Diagram
msoFreeform 5 Freeform
msoGraphic 28 Graphic
msoGroup 6 Group
msoInk 22 Ink
msoLine 9 Line
msoMedia 16 Media
msoPicture 13 Picture
msoPlaceholder 14 Placeholder
msoTable 19 Table