Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default 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
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
Validation of input against the active directory Sing Chung[_2_] Excel Worksheet Functions 1 July 23rd 09 04:19 PM
Have user input converted to uppercase in same cell as input? Shannonn New Users to Excel 1 June 20th 06 03:19 AM
Help creating link & formula from user input bturner2 Excel Programming 2 June 9th 04 07:19 PM
CODE to select range based on User Input or Value of Input Field Sandi Gauthier Excel Programming 4 December 8th 03 03:22 PM
specify an input directory with GetOpenFilename Valeria[_2_] Excel Programming 2 November 25th 03 05:32 PM


All times are GMT +1. The time now is 12:50 PM.

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"