Public
Sub
csvToxlsx()
Dim
FSO
As
Object
Dim
folder
As
Object
Dim
wb
As
Object
csvPath = "\\afspv1hom001.eu1.1corp.org\g126725$\Documents\Tool abc\"
xlsPath = "\\afspv1hom001.eu1.1corp.org\g126725$\Documents\Tool abc\"
Set
FSO = CreateObject(
"Scripting.FileSystemObject"
)
Set
CSVfolder = FSO.GetFolder(csvPath)
If
FSO.FolderExists(xlsPath) =
False
Then
FSO.createFolder (xlsPath)
End
If
Set
XlsFolder = FSO.GetFolder(xlsPath)
With
Application
.DisplayAlerts =
False
.ScreenUpdating =
False
End
With
For
Each
wb
In
CSVfolder.Files
If
LCase(Right(wb.Name, 3)) =
"csv"
Then
Set
activeWB = Workbooks.Open(wb)
activeWB.SaveAs FileName:=xlsPath &
"\" & Left(activeWB.Name, Len(activeWB.Name) - 3) & "
xlsx", FileFormat:=xlOpenXMLWorkbook, Local:=
True
activeWB.Close
True
End
If
Next
With
Application
.DisplayAlerts =
True
.ScreenUpdating =
True
End
With
End
Sub