computing
  • 0

automated folder creation in excel

  • 0

Hey all,

New to this forum and also relatively new to VBA. I apologise if this is a bit long, but I want to make my problem as clear as I can.

I’ve created a file tracking system for work with information on customers, projects and who’s working on them etc.

What I wish to achieve is to create a macro that will create folders in our shared drive based on the input in a specific row. This will help reduce the time taken on admin.

So for a new file entry (e.g. filename; customer; project;…) I would want to create folders for C:customerprojectfilename

It would need an input box so that the user can input the row or file name that they wish to create the folder for.

I will then map this macro to an object on the screen so that the user only has to push a button and select a row to create the desired folders.

Any help will be greatly appreciated and if you have any questions don’t hesitate to ask.

Ben

 

Share

0 Answers

  1. You need to use the FileSystemObject. Here is some sample code to get you thinking,

    Sub ChangeReadOnly()
    Dim fs, f, f1, fc, s, sf, CurrentDirectory, df, d1
    Set fs = CreateObject(“Scripting.FileSystemObject”)
    Set f = fs.GetFolder(“H:”)
    Set sf = f.subfolders
    For Each f1 In sf
    If f1.ReadOnly = True Then
    Set f1.ReadOnly = False
    End If
    Next
    End Sub

    • 0