How do I create folders within a folder in Excel VBA ?
Posted on 2013-11-22
I have an Excel 2010 VBA application in which I create a new empty folder ("\Training") on my C: drive. This works successfully.
However, I want to also create 2 empty subfolders within the \Training folder but I'm not sure how to do this.
Further, how do I check MKDIR to ensure it has successfully created the folders ?
This is my code thus far ...
Dim MyPath As String
MyPath = Environ("USERPROFILE") & "\Training"
If Len(Dir(MyPath, vbDirectory)) = 0 Then
' Create a '\Booking' folder and a '\Finance' folder inside the '\Training' folder
MsgBox "A new Windows folder with subfolders has been created successfully", vbInformation
Thanks for your help