Yes, but that won't send it to the recycle bin. If you want to then do this
VB Code:
Private Type SHFILEOPTSTRUCT
hwnd As Long
wFunc As Long
pFrom As String
pTo As String
fFlags As Integer
fAnyOperationsAborted As Long
hNameMappings As Long
lpszProgressTitle As Long
End Type
Private Declare Function SHFileOperation Lib "shell32.dll" _
Alias "SHFileOperationA" (lpFileOp As SHFILEOPTSTRUCT) As Long
Private Const FO_DELETE = &H3
Private Const FOF_ALLOWUNDO = &H40
Private Sub cmdDel_Click()
DeleteFileToRecycleBin (Desired Location)
End Sub
Public Sub DeleteFileToRecycleBin(Filename As String)
Dim fop As SHFILEOPTSTRUCT
With fop
.wFunc = FO_DELETE
.pFrom = Filename
.fFlags = FOF_ALLOWUNDO
End With
SHFileOperation fop
End Sub