Code: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
I Have a Macro that works perfectly & I need a little changes in it, Changes are mentioned Below
1)this macro works only if the file is located in test folder & I want to define the path in the macro, My file alway's be located in C:\Users\WolfieeeStyle\Desktop\Alert..csv & this macro should convert only that file from .csv to .xls & it should delete the .csv file & keep the .xls file to the same location
And I don't want any msg & any notification stating anything
So request u to plz look into it




Reply With Quote

Bookmarks