Sub test()
Dim p, f, myName
p = ThisWorkbook.Path & "\"
myName = ThisWorkbook.Name
f = Dir(p)
Do While f <> ""
If isKill
2(myName, f) Then Kill p & f
f = Dir
Loop
End Sub
'情况1
Function isKill1(myName, f) As Boolean
If f <> myName Then isKill1 = True
End Function
'情况2
Function isKill2(myName, f) As Boolean
If f <> myName Then
If Left(UCase(f), 1) = "F" Then
If f Like "*.xl*" Then '满足简单情况,不是精确判断
isKill2 = True
End If
End If
End If
End Function
'情况3
Function isKill3(myName, f) As Boolean
If f <> myName Then
If Asc(Left(f, 1)) < 0 Then
isKill3 = True
End If
End If
End Function
'情况4
Function isKill4(myName, f) As Boolean
If f <> myName Then
If Left(UCase(f), 1) = "F" Then
isKill4 = True
End If
End If
End Function
1.rar
(15.43 KB, 下载次数: 8)