I don't know what is the problem in your code.. I think you missed some parts for the code
Can you provide us the link for this code
Generally try the following code to do the task
Sub CSVToXLS()
Dim fPath As String, fPathDONE As String, fCOUNT As Long
Dim fName As String, fType As String
Dim fAfter As String, NwName As String
fPath = ThisWorkbook.Path & "\Test\"
If Right(fPath, 1) <> "\" Then fPath = fPath & "\"
fPathDONE = fPath & "\Converted\"
MakeFolders fPathDONE
fName = Dir(fPath & "*.CSV")
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Do While Len(fName) > 0
NwName = Left(fName, InStrRev(fName, ".") - 1)
Workbooks.Open fPath & fName
ActiveSheet.Name = NwName
ActiveWorkbook.SaveAs fPath & NwName & ".xls", FileFormat:=xlNormal
ActiveWorkbook.Close
Name fPath & fName As fPathDONE & fName
fCOUNT = fCOUNT + 1
fName = Dir()
Loop
MsgBox "A Total Of " & fCOUNT & " Files Were Processed"
Application.ScreenUpdating = True
End Sub
Function MakeFolders(MyStr As String)
Dim MyArr As Variant
Dim pNum As Long
Dim pBuf As String
On Error Resume Next
MyArr = Split(MyStr, "\")
pBuf = MyArr(LBound(MyArr)) & "\"
For pNum = LBound(MyArr) + 1 To UBound(MyArr)
pBuf = pBuf & MyArr(pNum) & "\"
MkDir pBuf
Next pNum
End Function
Bookmarks