Compile error
Syntax error
This is the original code:
Code: Select all
Sub DeleteAllObjectsInFolder()
Const strFolder = "C:\...\Library\"
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
Code: Select all
If UCase(wsh.Name) <> "DASH", "Rep 36" Then