shyoung192
New Member
- Joined
- Dec 27, 2022
- Messages
- 3
- Office Version
- 365
- Platform
- Windows
I used this VBA code to create 2022 folders flawlessly, now when trying to create 2023 folders I am getting an error message...
Runtime Error '5'
Invalid Procedure call or Argument
Debug is on the "Shell ("cmd/c md"&... )) Line
It is asking me to put in a Folder name and I can't remember the format I used...
Any assistance would be greatly appreciated...
Sub FolderCreator()
Dim objRow As Range, objCell As Range, strFolders As String, rootFolder As String
With Application.FileDialog(msoFileDialogFolderPicker)
' show the file picker dialog box
If .Show <> 0 Then
rootFolder = .SelectedItems(1)
End If
End With
For Each objRow In ActiveSheet.UsedRange.Rows
strFolders = rootFolder
For Each objCell In objRow.Cells
strFolders = strFolders & "\" & objCell
Next
Shell ("cmd /c md " & Chr(34) & strFolders & Chr(34))
Next
End Sub
Runtime Error '5'
Invalid Procedure call or Argument
Debug is on the "Shell ("cmd/c md"&... )) Line
It is asking me to put in a Folder name and I can't remember the format I used...
Any assistance would be greatly appreciated...
Sub FolderCreator()
Dim objRow As Range, objCell As Range, strFolders As String, rootFolder As String
With Application.FileDialog(msoFileDialogFolderPicker)
' show the file picker dialog box
If .Show <> 0 Then
rootFolder = .SelectedItems(1)
End If
End With
For Each objRow In ActiveSheet.UsedRange.Rows
strFolders = rootFolder
For Each objCell In objRow.Cells
strFolders = strFolders & "\" & objCell
Next
Shell ("cmd /c md " & Chr(34) & strFolders & Chr(34))
Next
End Sub