Home |
Search |
Today's Posts |
|
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Creating a Directory from a user input
Hi
This is working for me with in G4 "C:\Data" (The Data folder already exist) and in I3 "Testfolder" Sub MakeDirectory() Dim project_dir As String Dim Project_spec As String Dim Project_path As String Dim fs As Object Set fs = CreateObject("Scripting.FileSystemObject") project_dir = Worksheets("Road Editor").Range("G4") Project_spec = Worksheets("Road Editor").Range("I3") Project_path = project_dir & "\" & Project_spec If Not fs.FolderExists(Project_path) Then fs.CreateFolder Project_path Else ' do nothing End If End Sub -- Regards Ron de Bruin http://www.rondebruin.nl "mathew" wrote in message ... I need to check to see if a directory exists and if it does not then create it. I can do this when I specify the directory in the last two lines of the VB sub-routine, however, I need to get the path statement from 2 different user input cells on the worksheet. Here is what I have. Can you please help! Dim project_dir As String Dim Project_spec As String Dim Project_path As String project_dir = Worksheets("Road Editor").Range("G4") Project_spec = Worksheets("Road Editor").Range("I3") Project_path = project_dir & "\" & Project_spec On Error Resume Next ChDir "Project_path" If Err < 0 Then MkDir "Project_path" |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Validation of input against the active directory | Excel Worksheet Functions | |||
Have user input converted to uppercase in same cell as input? | New Users to Excel | |||
Help creating link & formula from user input | Excel Programming | |||
CODE to select range based on User Input or Value of Input Field | Excel Programming | |||
specify an input directory with GetOpenFilename | Excel Programming |