I have the code and is working all perfect, but it is not deleting only this file from folder (Interaction Reports_637169203236732652.xlsx). Not sure as what is wrong
VBA Code:
Sub DeleteRawfile()
'' This will Delete the raw files from the folder
Sheets("Reference").Select
Dim oFolder As Object, oFile As Object, i As Integer
Dim xDir As String
xDir = Application.ActiveWorkbook.Path
With Worksheets("Reference")
With CreateObject("Scripting.FileSystemObject")
Set oFolder = .GetFolder(xDir)
For Each oFile In oFolder.Files
Select Case LCase(.GetExtensionName(oFile))
Case "xls", "xlsb", "csv", "xlsx"
Cells(i + 2, 8) = oFile.Path
On Error Resume Next
kill oFile.Path --- 'delete files from folder'
i = i + 1
End Select
Next oFile
End With
End With
Range("H2:H20").Select
Selection.Cells.Clear
Range("a2").Select
End Sub