Sie benötigen lediglich eine Form, einen CommandButton und alternativ eine Textbox.
Private Declare Function SHFileOperation Lib "shell32.dll" _
Alias "SHFileOperationA" (lpFileOp As SHFILEOPSTRUCT) _
As Long
Private Type SHFILEOPSTRUCT
hWnd As Long
wFunc As Long
pFrom As String
pTo As String
fFlags As Integer
fAborted As Long
hNameMaps As Long
sProgress As String
End Type
Const FO_DELETE = &H3
Const FOF_ALLOWUNDO = &H40
Private Sub Command1_Click()
Dim File As String
Dim DelBin As SHFILEOPSTRUCT
' Nehmen Sie für File eine existierende
' Datei oder wählen Sie den Eintrag aus
' einer Textbox
File = "C:\dummy.txt"
With DelBin
.hWnd = Me.hWnd
.wFunc = FO_DELETE
.pFrom = File
.fFlags = FOF_ALLOWUNDO
.pTo = "" & Chr$(0)
End With
SHFileOperation DelBin
End Sub