fth said:
Hello,
Yes, I understand that mkdir can't make a subfolder.
My problem is that the path is not the same for each record;
here's my code:
actualmigpath = Mid([AppliPath], 4)
NewMigPath = "d:\MigAppli"
FullPath = NewMigPath & actualmigpath
If Dir(FullPath) = "" Then
MkDir FullPath
...
My case is a solution to copy all my .mdb in a new directory where I
create sub folder like the original one.
Many thanks by advance
Here's a procedure that will build a folder path, creating any folders
that don't already exists:
'----- start of code -----
Sub MakePath(pstrPath As String)
Dim strPath As String
Dim aFolders() As String
Dim I As Integer
strPath = Trim(pstrPath)
If Len(strPath) = 0 Then
Err.Raise 5
Exit Sub
End If
aFolders = Split(strPath, "\")
strPath = vbNullString
For I = LBound(aFolders) To UBound(aFolders)
strPath = strPath & aFolders(I)
If Len(Dir(strPath, vbDirectory)) = 0 Then
MkDir strPath
End If
strPath = strPath & "\"
Next I
End Sub
'----- end of code -----
Warning: it's only lightly tested.
You should be able to use code like this:
actualmigpath = Mid([AppliPath], 4)
NewMigPath = "d:\MigAppli"
FullPath = NewMigPath & actualmigpath
If Len(Dir(FullPath, vbDirectory)) = 0 Then
MakePath FullPath
End If