
20-03-2008, 13:58
|
|
|
|
חבר מתאריך: 31.10.07
הודעות: 28
|
|
|
זה הדרך לעבוד עם תיקיות בVB
להוסיף ב referens את התיקיה Microsoft Scripting Runtime
קוד:
Private Function CreateFolder(sFolder As String) As Boolean
On Error GoTo NoFolder
Dim Fso As New FileSystemObject
Dim ArrList() As String
Dim Path As String
Dim i As Integer
Chack_CreateFolder = False
If Fso.FolderExists(sFolder) Then
CreateFolder = True
Exit Function
End If
ArrList = Split(sFolder, "\")
If Not IsNull(ArrList) Then
For i = LBound(ArrList) To UBound(ArrList)
Path = Path & ArrList(i)
If Not Fso.FolderExists(Path) Then
Fso.CreateFolder Path
End If
Path = Path & "\"
Next i
End If
If Fso.FolderExists(sFolder) Then
CreateFolder = True
End If
NoFolder:
End Function
Private Function DeleteFolder(sFolder As String, bForce As Boolean)
On Error GoTo ERR
Dim Fso As New FileSystemObject
If Fso.FolderExists(sFolder) Then
Fso.DeleteFolder sFolder, bForce
DeleteFolder = True
End If
ERR:
DeleteFolder = False
End Function
|