Solución:
Podrías usar esta función:
Const PATH = "X:folder0folder1folder2"
Set fso = CreateObject("Scripting.FileSystemObject")
BuildFullPath PATH
Sub BuildFullPath(ByVal FullPath)
If Not fso.FolderExists(FullPath) Then
BuildFullPath fso.GetParentFolderName(FullPath)
fso.CreateFolder FullPath
End If
End Sub
O simplemente llame al comando mkdir desde su script:
Set objShell = CreateObject("Wscript.Shell")
objShell.Run "cmd /c mkdir X:folder1folder2folder3"
Debe dividir la ruta completa y crear cada carpeta. Función de ejemplo:
Function CreateFolderRecursive(FullPath)
Dim arr, dir, path
Dim oFs
Set oFs = WScript.CreateObject("Scripting.FileSystemObject")
arr = split(FullPath, "")
path = ""
For Each dir In arr
If path <> "" Then path = path & ""
path = path & dir
If oFs.FolderExists(path) = False Then oFs.CreateFolder(path)
Next
End Function
Tarde para el programa, pero el objeto Shell.Application funciona para mí en XP, de la siguiente manera …
with CreateObject("Shell.Application")
set oFolder = .NameSpace("C:")
if (not oFolder is nothing) then oFolder.NewFolder("abcd")
end with
¡Haz clic para puntuar esta entrada!
(Votos: 0 Promedio: 0)