Computer Science Canada

[ASK] Newbie del file

Author:  ikurniawan [ Sat May 16, 2009 11:16 am ]
Post subject:  [ASK] Newbie del file

hi all,

Please help me, I'll try to delete some file it was succes, but if i push del twice message "Path not found" yes i know this error because the file is not found, now I want to change that message if I push twice with my own message, i'll try use Msgbox vbOKonly but not work, I want if I push twice just message "File empty" with vbokonly and go back to form
code:
Sub del()
Dim path As String
Dim x As String
path = "E:\data\*.txt"
If path <> "" Then
 x = MsgBox(" sure want delete??", vbOKCancel + vbInformation, "info1")
If x = vbOK Then
kill "E:\data\*.txt"
    MsgBox " has been located.", vbOKOnly + vbInformation, "info2"
    Else
    MsgBox " file empty.", vbOKOnly + vbInformation, "info3"
End If
End If
End Sub


please help thx

Author:  ikurniawan [ Sat May 16, 2009 1:58 pm ]
Post subject:  Re: [ASK] Newbie del file

thx to planet source code, the problem is resolve
code:
Private Sub Command2_Click()
On Error GoTo Err_command2_Click

Kill "E:\Data\*.txt"
Err_command2_Click:
 MsgBox "file was deleted", vbOKOnly + vbCritical, "info"
 
End Sub


that's all


: