![]() |
mkdir
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 |
mkdir
If Dir(save_path2, vbDirectory) = "" Then MkDir save_path2
-- HTH Bob (there's no email, no snail mail, but somewhere should be gmail in my addy) "Peter" wrote in message ups.com... 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 |
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 |
All times are GMT +1. The time now is 01:43 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com