Avatar of Wm Allen Smith
Wm Allen Smith

asked on 

Looping Through a Excel Folder Directory to Delete Shapes

I need to loop through a folder of excel files and delete the drawing objects  on specified sheets within each workbook..  I have found the following code to delete
shapes on an active worksheet,

Sub DeleteShapes()
Dim Shp As Shape
For Each Shp In ActiveSheet.Shapes
Shp.Delete
Next Shp
End Sub

but I need to loop through an entire directory of excel files and delete the shapes on two specified named tabs. Each  file has the same two named tabs. Is there a way to  automate this process? I cannot get the workbook open Method to work without an error.
Thanks!
VBAMicrosoft ExcelMicrosoft Office

Avatar of undefined
Last Comment
byundt

8/22/2022 - Mon