Public Sub CreateFolders(ByVal strPath As String) Dim fso As Object Dim strSlash As Integer Dim strFolderDir As String
Set fso = CreateObject("Scripting.FileSystemObject") strSlash = 1
Do While strSlash > 0 strSlash = InStr(strSlash + 1, strPath, "\") If strSlash > 0 Then strFolderDir = Left(strPath, strSlash - 1) If Not fso.FolderExists(strFolderDir) Then fso.CreateFolder strFolderDir End If End If Loop If Not fso.FolderExists(strPath) Then fso.CreateFolder strPath End If
Set fso = Nothing End Sub
Private Sub Form_Load() ' Call CreateFolders("C:\Test\Test2\Test3") ' eller ' Call CreateFolders("C:\Test\Test2\Test3\") End Sub
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.