Ago
04-02-2010, 05:41 AM
I just noticed a problem in my code.
The user can choose a folder with a Filedialog and the path will be printed in TextBox3.
The user should now be able to make a new directory in this textbox.
An easy example, user selects Drive D which is completly empty.
Textbox shows D:\
The user can now type a new directoryname in the textbox.
D:\Testfolder
If Dir(UserForm2.TextBox3.Value, vbDirectory) = "" Then 'If folder dont exist
MkDir UserForm2.TextBox3.Value 'Create it
End If
And the folder is created, but if user types:
D:\Testfolder\Test1
The code will stop because Testfolder has not been created yet.
Is there any way i can create multiple direcrories?
I know i could "loop" trough each part of the path, but is there any easier ways?
The user can choose a folder with a Filedialog and the path will be printed in TextBox3.
The user should now be able to make a new directory in this textbox.
An easy example, user selects Drive D which is completly empty.
Textbox shows D:\
The user can now type a new directoryname in the textbox.
D:\Testfolder
If Dir(UserForm2.TextBox3.Value, vbDirectory) = "" Then 'If folder dont exist
MkDir UserForm2.TextBox3.Value 'Create it
End If
And the folder is created, but if user types:
D:\Testfolder\Test1
The code will stop because Testfolder has not been created yet.
Is there any way i can create multiple direcrories?
I know i could "loop" trough each part of the path, but is there any easier ways?