Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

Simple folder creation for a VB simpleton

Status
Not open for further replies.

windsurferm

Automotive
Jan 11, 2005
32
0
0
GB
We have a generic folder structure which we use for all new projects we start, each new project gets a project number from an excel sheet and currently the individual has to then create the folder, to the same number and then copy the folders from the generic structure into the newly created folder.

I would like to create a button which does all of the above steps with the press of one VB button at the end of the line. However I am not proficient with VB and am looking for some general pointers.
 
Replies continue below

Recommended for you

Add a reference to the Windows Script Host Model (Tools|References Menu) then you can simply use the FileSystemObject:
Code:
Private Sub cmdMkDir_Click()
mygroup = "C:\Test" 'originals
mynewdir = "c:\test" & CStr(Range("A12").Value)
MkDir mynewdir
Dim w As New FileSystemObject
w.CopyFolder mygroup, mynewdir & "\", True
Set w = Nothing
End Sub

This example picks up the value in Cell A12 and concatenates that value onto 'test' giving the new directory a name such as 'test233' (if A12 contains 233). You will need to add error checking to ensure that the directory doesn't already exist.

Good Luck
johnwm
________________________________________________________
To get the best from these forums read faq731-376 before posting

UK steam enthusiasts:
 
Status
Not open for further replies.
Back
Top