Берём какой-нибудь скрипт с
заменой символов и изменяем под задачу.
Option Explicit
Const VERSION = "rev100"
Const VERSIONDATE = "17/10/2016"
Sub ProcessDir(folder)
Dim fname, file, subfolder, i
Const ForReading = 1
Const ForWriting = 2
Const xlOpenXMLWorkbook = 51
For Each file In folder.Files
If extold = LCase(fso.GetExtensionName(file)) Then
fname = file.Path
Set fl = fso.OpenTextFile(fname, ForReading, False)
txt = Split(fl.ReadAll(), vbCrLf)
For i = 0 To UBound(txt)
txt(i) = Replace(txt(i), ";", ",")
Next
fl.Close
file.Name = file.Name & "_bak"
Set fl = fso.CreateTextFile(fname, True)
fl.Write Join(txt, vbCrLf)
fl.Close
End If
Next
For Each file In folder.Files
If extold = LCase(fso.GetExtensionName(file)) Then
fname = file.Path
Set fl = CreateObject("Excel.Application")
' fl.Visible = True ' Debug
With fl.Workbooks.Open(fname)
' Do Something... '
.SaveAs Replace(fname, extold, extnew), xlOpenXMLWorkbook: .Close False
End With
fso.DeleteFile(Replace(fname, extold & "_bak", extold))
End If
Next
For Each file In folder.Files
If extold & "_bak"= LCase(fso.GetExtensionName(file)) Then
file.Name = Replace(file.Name, extold & "_bak", extold)
MsgBox "File " & file.Name & " successfully created.", vbInformation
End If
Next
For Each subfolder In folder.SubFolders
ProcessDir (subfolder)
Next
End Sub
Dim fso, folder, fl, txt
folder = "C:\Users\User\Desktop\"
' Change the extension in the program settings
Const extold = "csv"
' This extension can be written after changing semicolon to a comma
Const extnew = "xlsx"
Set fso = CreateObject("Scripting.FileSystemObject")
Set folder = fso.GetFolder(folder)
ProcessDir (folder)
Set fso = Nothing