方法有好几种:
1 使用 kill 例如:Kill "c:\temp.txt"
2 使用 FileSystemObject 例如:
Dim FSO As FileSystemObject
Set FSO = New FileSystemObject
FSO.DeleteFile "c:\temp.txt"

解决方案 »

  1.   

    kill filename(include path)
    filesystemobject
    'add reference microsoft scripting runtime into vbDim FsoDel As New FileSystemObject
    Private Sub Command2_Click()
        Dim i As Long
        Dim strFileName As String
        Dim j As Integer
        j = 0
        For i = 28249 To 39196
            strFileName = "D:\image\image\" & CStr(i) & "_5.bmp"
            Debug.Print strFileName
            If FsoDel.FileExists(strFileName) Then
                FsoDel.DeleteFile strFileName, True
                j = j + 1
            End If
        Next
        MsgBox "共有" & CStr(j) & "图片删除成功"
    End Sub
      

  2.   

    用kill filename 比较简单
      

  3.   

    用FSO(File System Object)