I need code how to create folder in specific path, I have path in the variable and want to create a folder in that path.Please specify what problem you are facing...or post sample file with your coding.
Hi Ankush.. Thanks for your reply, could you please check again every time I am getting msgbox "Folder With Same Name is Already Exists There" and not creating folder. [U]Fluff13[/U] code is working as per my requirement.Code:Sub test() Set c = CreateObject("Scripting.FileSystemObject") f = "C:\NewF" 'Change folder name and path here If c.FolderExists(f) Then MsgBox "Folder With Same Name is Already Exists There" Else c.CreateFolder f MsgBox "Folder Created" End If End Sub [code/]
Thanks Fluff.. That I want exactly Do we have any other method to create Folder or have to use VbDir.Another option
Code:Sub riya() Dim Pth As String, NewFolder As String Pth = "C:\Testa\" NewFolder = "Testb" If Dir(Pth, vbDirectory) <> "" And Dir(Pth & NewFolder, vbDirectory) = "" Then MkDir (Pth & NewFolder) End If End Sub
This is because folder with same name have been already there...get rid of that folder or change folder name and run.Hi Ankush.. Thanks for your reply, could you please check again every time I am getting msgbox "Folder With Same Name is Already Exists There" and not creating folder. [U]Fluff13[/U] code is working as per my requirement.
Yup, got it thanks..This is because folder with same name have been already there...get rid of that folder or change folder name and run.
There are a number of other ways to do it. I simply prefer using Dir/MkDirThanks Fluff.. That I want exactly Do we have any other method to create Folder or have to use VbDir.