Private Type SHFILEOPSTRUCT
hwnd As Long
wFunc As Long
pFrom As String
pTo As String
fFlags As Integer
fAnyOperationsAborted As Long
hNameMappings As Long
lpszProgressTitle As String ' only used if FOF_SIMPLEPROGRESS
End Type
Public Sub Recycle(ByVal FileName As String)
Dim CFileStruct As SHFILEOPSTRUCT
With CFileStruct
.hwnd = Me.hwnd
.fFlags = FOF_ALLOWUNDO
.pFrom = FileName
.wFunc = FO_DELETE
End With
If SHFileOperation(CFileStruct) <> ERROR_SUCCESS Then
'An error occurred.
End If
End Sub
Sub Test()
Call Recycle("C:\Moms_Files\Pornlist.doc")
End Sub
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.