#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 48
Default 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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default 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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 131
Default 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
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
MKDir not working Robert_L_Ross Excel Programming 3 June 30th 06 07:17 AM
MkDir and Save As wtpcomplab Excel Programming 2 December 9th 04 09:09 PM
mkdir problem Tom Ogilvy Excel Programming 2 August 31st 04 03:22 PM
mkdir problem Norman Jones Excel Programming 0 August 30th 04 04:37 PM
MkDir error Eric Excel Programming 3 May 17th 04 08:58 PM


All times are GMT +1. The time now is 07:01 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"