Hi There,
I'm trying to create a program that will create a number of folders for a person. I have the creating part figured out but I'm having troubles specifying in what folder I want these new folders created in. I tried re-working some code I have that will pull file names out of a specific folder but unfortunately I can't get it to work for my intended purposes. Appreciate any thoughts on this. Please code below:
Sub ScriptingRunLibrary()
Dim fso As Scripting.FileSystemObject
Dim NewFolderPath As String
Dim s1 As String
Dim Target As String
Dim OldFolder As Scripting.Folder
Target = InputBox("Please Paste Target Folder Path Here")
FolderPath = Target
Set fso = New Scripting.FileSystemObject
Set OldFolder = fso.GetFolder(Target)
Range("C1").Select
For Each r In Range(ActiveCell.Offset(1, 0), ActiveCell.End(xlDown))
s1 = ActiveCell.Value
If Not fso.FolderExists(s1) Then
fso.CreateFolder s1
End If
ActiveCell.Offset(1, 0).Select
If ActiveCell.Value = "" Then
Exit For
End If
Next r
Set fso = Nothing
End Sub
Cheers
Trapper
I'm trying to create a program that will create a number of folders for a person. I have the creating part figured out but I'm having troubles specifying in what folder I want these new folders created in. I tried re-working some code I have that will pull file names out of a specific folder but unfortunately I can't get it to work for my intended purposes. Appreciate any thoughts on this. Please code below:
Sub ScriptingRunLibrary()
Dim fso As Scripting.FileSystemObject
Dim NewFolderPath As String
Dim s1 As String
Dim Target As String
Dim OldFolder As Scripting.Folder
Target = InputBox("Please Paste Target Folder Path Here")
FolderPath = Target
Set fso = New Scripting.FileSystemObject
Set OldFolder = fso.GetFolder(Target)
Range("C1").Select
For Each r In Range(ActiveCell.Offset(1, 0), ActiveCell.End(xlDown))
s1 = ActiveCell.Value
If Not fso.FolderExists(s1) Then
fso.CreateFolder s1
End If
ActiveCell.Offset(1, 0).Select
If ActiveCell.Value = "" Then
Exit For
End If
Next r
Set fso = Nothing
End Sub
Cheers
Trapper