View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Don Guillett Don Guillett is offline
external usenet poster
 
Posts: 10,124
Default Delete rather than make Invisible

Try this to CUT(delete) all shapes on the active sheet

Sub ShapesCut()
For Each s In ActiveSheet.Shapes
s.Cut
Next
End Sub

--
Don Guillett
SalesAid Software

"Corey" wrote in message
...
I am yet to solve the problem with my Excel file being 56mb is size
although ALL photos have been
removed but the below may hold the key?

Sub DeleteAllPhotos()
MsgBox "Are You Sure you want to Delete ALL the Photo's ?", , "...."

Worksheets("Photo's").Select
Dim lnCnt As Long, sStr As String ' Declare Variables (Dimension Them)
Application.ScreenUpdating = False ' Turns off use of the screen, makes
exceution faster and
less distraction
For lnCnt = 1 To ActiveSheet.Shapes.Count ' Common Loop, FOR 1 to 10 =
loops 10 times
With ActiveSheet.Shapes(lnCnt) ' Everything I now do I do WITH ...
until END WITH
sStr = Left(.Name, 1) ' assigns the first letter of oject name to
sStr
If sStr < "S" Then ' if NOT S, as you can see these can be
'nested'
If sStr < "B" Then ' if NOT B, as you can see these can be
'nested'
'.Visible = False ' make current item invisible '<===== Delete
the Photo's instead

If sStr = "L" Then .Line.ForeColor.SchemeColor = 8
End If
End If
End With
Next
Application.ScreenUpdating = True
End Sub


How can i adapt this code to Delete rather than make invisible the photos,
or is that the same??

Will it also reduce the size of the file?


Corey....