mkdir
"Peter" wrote:
Does anyone have any idea why this doesn't work? I keep getting a Path
not found (Error 76) message and the mkdir (save_path2) part of the
code highlighted.
If Dir(save_path2, vbDirectory) = "" Then MkDir (save_path2)
Thanks,
Peter
You can also check if the parent folder exists before you use MkDir
Sub test()
Set fso = CreateObject _
("Scripting.FileSystemObject")
save_path2 = "C:\blah\myDir"
parentFolder = fso.GetParentFolderName(save_path2)
If fso.FolderExists(parentFolder) _
And Not fso.FolderExists(save_path2) Then
MkDir save_path2
Else
MsgBox "Could not create folder"
End If
End Sub
Hope this helps.
--
urkec
|