I'm trying to convert windows CRLF newline to UNIX LF newline with a POWERSHELL command. I would like a VBA macro to do that.
So far my code is:
Sub conversiontoUNIX()
Dim wsh As Object
Set wsh = VBA.CreateObject("WScript.Shell")
Dim waitOnReturn As Boolean: waitOnReturn = True
Dim windowStyle As Integer: windowStyle = 1
Dim file As String, listfichiers As Variant, outputfolder As String, replace As String, command_shell As Variant
outputfolder = Environ("USERPROFILE") & "\Downloads\" & "run_param_" & Format(Date, "dd_mm_yy")
listfichiers = listfiles(outputfolder)
For filx = LBound(listfichiers) To UBound(listfichiers)
file = outputfolder & "\" & listfichiers(filx)
Requst = "PowerShell -noexit -Command (Get-Content " & file & ") -join ""`n"" > " & file & ""
command_shell = Shell(Requst, vbNormalFocus)
Next filx
End Sub
How can i manage to run my code ?
Best regards,
Jouvzer