Here is the code I have used so far to make the original foilders and it
works perfectly,
Option Explicit
Dim intRow, objExcel, objSheet, strPathExcel
Dim strHomeFolder, strHome, strUser
Dim objFSO, objShell, intRunError
Dim objFolder,colFolders
' Note you will have to amend the following variables
strHome = "H:\clients\"
strPathExcel = "H:\cls.xls"
intRow = 2 ' Row 1 contains headings
' Open the Excel spreadsheet
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objExcel = CreateObject("Excel.Application")
Set objSheet = objExcel.Workbooks.Open(strPathExcel)
' Create a shell for cmd and CACLS
Set objShell = CreateObject("Wscript.Shell")
' Here is the loop that cycles through the cells
Do Until (objExcel.Cells(intRow,1).Value) = ""
strUser = objExcel.Cells(intRow, 1).Value
call HomeDir ' I decided to use a subroutine
intRow = intRow + 1
Loop
objExcel.Quit ' Clears up Excel
Sub HomeDir()
strHomeFolder = strHome & strUser
If strHomeFolder <> "" Then
If Not objFSO.FolderExists(strHomeFolder) Then
On Error Resume Next
objFSO.CreateFolder strHomeFolder
If Err.Number <> 0 Then
On Error GoTo 0
Wscript.Echo "Cannot create: " & strHomeFolder
End If
End If
End If
End Sub
objExcel.Quit
WScript.Quit
Where would I insert that code to make this work?
I need a sub set of folders in each of the orginal folders named things like
taxes, payroll, forms, each folder will have the same subfolders.