Public Sub MakeFolder_1()
Dim objFSO As Object
Dim FolderPath As String
Const FOLDER_NAME As String = "TestFolder"
Set objFSO = CreateObject("Scripting.FileSystemObject")
FolderPath = ThisWorkbook.Path & "\" & FOLDER_NAME
If objFSO.FolderExists(Folderspec:=FolderPath) = True Then
On Error Resume Next
Kill FolderPath & "\*.*"
On Error GoTo 0
RmDir FolderPath
End If
objFSO.CreateFolder FolderPath
End Sub
|