Yesterday you gave this code (below) so that all pictures will be deleted, except sheet "DASH". Is it possible to modify this code so that it will delete all the pictures named picture 1?
Code: Select all
Sub DeleteAllObjectsInFolder()
Const strFolder = "C:\...\2. February 2019\"
Dim strFile As String
Dim wbk As Workbook
Dim wsh As Worksheet
Dim i As Long
Dim f As Boolean
Application.ScreenUpdating = False
Application.EnableEvents = False
Application.Calculation = xlCalculationManual
strFile = Dir(strFolder & "*.xls*")
Do While strFile <> ""
Set wbk = Workbooks.Open(Filename:=strFolder & strFile, UpdateLinks:=False)
For Each wsh In wbk.Worksheets
If UCase(wsh.Name) <> "DASH" Then
f = wsh.ProtectContents
If f Then
wsh.Unprotect
End If
For i = wsh.Shapes.Count To 1 Step -1
wsh.Shapes(i).Delete
Next i
If f Then
wsh.Protect
End If
End If
Next wsh
wbk.Close SaveChanges:=True
strFile = Dir
Loop
Application.Calculation = xlCalculationAutomatic
Application.EnableEvents = True
Application.ScreenUpdating = True
End Sub