Does this code Delete pictures or simply makes them Invisible

C

Corey

In time am i going to have a very large file if many pictures have been used and removed by the
following code?


With Sheets("Procedure")
..Select
..Unprotect
Dim lnCnt As Long, sStr As String
Application.ScreenUpdating = False
For lnCnt = 1 To ActiveSheet.Shapes.Count
With ActiveSheet.Shapes(lnCnt)
sStr = Left(.Name, 1)
If sStr <> "S" Then
If sStr <> "B" Then
.Visible = False ' <== Are they deleted or are they stored with the file still ?
If sStr = "L" Then .Line.ForeColor.SchemeColor = 8
End If

End If
End With
Next


Corey....
 
G

Guest

Corey,

Setting the Visible property to false would make it hidden. It would still
be there.. To delete, use the Delete method.
 
C

Corey

Reverted to this:
Dim xlShape As Shape
For Each xlShape In ActiveSheet.Shapes
If xlShape.Type = msoPicture Then xlShape.Delete
Next
As i found the file was gaining in size as the pictures were simply invisible instead of being
deleted.

File dropped in size dramatically when run this the first time.



In time am i going to have a very large file if many pictures have been used and removed by the
following code?


With Sheets("Procedure")
..Select
..Unprotect
Dim lnCnt As Long, sStr As String
Application.ScreenUpdating = False
For lnCnt = 1 To ActiveSheet.Shapes.Count
With ActiveSheet.Shapes(lnCnt)
sStr = Left(.Name, 1)
If sStr <> "S" Then
If sStr <> "B" Then
.Visible = False ' <== Are they deleted or are they stored with the file still ?
If sStr = "L" Then .Line.ForeColor.SchemeColor = 8
End If

End If
End With
Next


Corey....
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top