toidjtjmtoi > 08-05-20, 02:14 PM
maidinhdan > 08-05-20, 04:03 PM
(08-05-20, 02:14 PM)toidjtjmtoi Đã viết: Có nút nào nhấn vào sẽ xóa luôn file access ko nhỉ
Public Sub XoaFileKhac() 'Thuoc Modules: basThaotacfile
'Chen cac Thu tuc cua ban o day: Neu nhan nhieu lan Nho la doi ten TenSubCanTao
Dim FSO As Object, objFile As Object
Set FSO = CreateObject("Scripting.FileSystemObject")
Set objFile = FSO.GetFile("D:\TenFileCanXoa.mdb")
objFile.Delete
Set objFile = nothing
End Sub
Sub XoaFile(ByVal LinkFile As String)
If FileExists(LinkFile) Then 'Kiểm tra File có tồn tại không
SetAttr LinkFile, vbNormal
'Xoa file
Kill LinkFile
End If
End Sub
Function cmdXoaFile()
Dim oShell, oExec As Variant, LinkFile As String
Set oShell = CreateObject("WScript.Shell")
LinkFile = CurrentProject.path & "\" & CurrentProject.Name
Set oExec = oShell.Exec("DEL " & Chr(34) & LinkFile & Chr(34) & " /F ", vbHide)
End Function
tranthanhan1962 > 08-05-20, 05:01 PM
Xuân Thanh > 08-05-20, 05:16 PM