dtmYesterday = Date - 1 strYear = Year(dtmYesterday) strMonth = Month(dtmYesterday) If Len(strMonth) = 1 Then strMonth = "0" & strMonth End If strDay = Day(dtmYesterday) If Len(strDay) = 1 Then strDay = "0" & strDay End If strYesterday = strYear & strMonth & strDay strFileName = "C://Backups//backup_" & strYesterday & ".bak" strComputer = "." Set objWMIService = GetObject("winmgmts://" & strComputer & "/root/cimv2") Set colFiles = objWMIService.ExecQuery _ ("Select * from CIM_DataFile where Name = '" & strFileName & "'") For Each objFile in colFiles objFile.Delete Next