Contact US

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Simple folder creation for a VB simpleton

Simple folder creation for a VB simpleton

Simple folder creation for a VB simpleton

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.

RE: Simple folder creation for a VB simpleton

Add a reference to the Windows Script Host Model (Tools|References Menu) then you can simply use the FileSystemObject:


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
To get the best from these forums read FAQ731-376 before posting

UK steam enthusiasts: www.essexsteam.co.uk

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members! Already a Member? Login


Close Box

Join Eng-Tips® Today!

Join your peers on the Internet's largest technical engineering professional community.
It's easy to join and it's free.

Here's Why Members Love Eng-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close