desain form seperti gambar di atas
lalu ketik listing seperti dibawah ini
Private Sub Command1_Click()
x = InputBox("Lokasi Dan nama Folder baru : ")
NewFolder (x)
End Sub
Private Function FolderExists(path) As Boolean
Dim fso
Set fso = CreateObject("Scripting.FileSystemObject")
If Len(path) > 3 Then
If fso.FolderExists(path) Then
FolderExists = True
Else
FolderExists = False
End If
End If
End Function
Private Function NewFolder(path)
Dim fso
Set fso = _
CreateObject("Scripting.FileSystemObject")
If Len(path) > 3 Then
If fso.FolderExists(path) Then
MsgBox "Folder Sudah ada !", vbInformation + vbOKOnly, "Informasi"
Else
fso.createfolder (path)
End If
End If
End Function
Private Function deleteFolder(path)
Set fso = CreateObject("Scripting.FileSystemObject")
If Len(path) > 3 Then
If fso.FolderExists(path) Then
fso.deleteFolder (path)
Else
MsgBox "Folder tidak ada !", vbInformation + vbOKOnly, "Informasi"
End If
End If
End Function
Private Sub Command2_Click()
y = InputBox("Lokasi Dan nama Folder Yng akan Dihapus : ")
deleteFolder (y)
End Sub
Selamat Mencoba
Senin, 09 Februari 2009
Create dan Delete File
Langganan:
Posting Komentar (Atom)
Tidak ada komentar:
Posting Komentar