Forum Discussion
KCkum
Nov 27, 2020Copper Contributor
Xero output file in CSV. How to convert to txt file for upload in bank system for payment
Hi I need some help to convert a file in CSV (Xero output) into a txt file for upload in bank system for payment. I am trying to build a process when I can take the CSV file, take the data and paste...
NikolinoDE
Nov 27, 2020Platinum Contributor
Fished fresh from the internet here, as there is no time.
Maybe this will help you to get on with your project.
Maybe this will help you to get on with your project.
Option Explicit
Sub Convert_CSV_to_XLS ()
Dim i As Long, delayed As String
Dim file Form As String
'With a backslash at the end
dir = "C: \ Folder1 \"
'File format
fileForm = "csv"
On Error GoTo error
ChDrive Left (galv, 2)
ChDir galv
With Application.FileSearch
.NewSearch
.LookIn = delayed
.SearchSubFolders = False
.FileType = msoFileTypeAllFiles
.Execute
For i = 1 To .FoundFiles.Count
Application.StatusBar = "File" & i & "from" & .FoundFiles.Count & "is being processed"
If Right (.FoundFiles (i), 3) = fileForm Then
Application.ScreenUpdating = False
Debug.Print .FoundFiles (i)
Workbooks.Open .FoundFiles (i), local: = True
ActiveWorkbook.SaveAs Left (.FoundFiles (i), Len (.FoundFiles (i)) - 3) & "xls"
ActiveWorkbook.Close False
Application.ScreenUpdating = True
End If
Next i
End With
Error Exit:
Application.ScreenUpdating = True
Application.StatusBar = False
Exit Sub
error:
MsgBox Err.Number & ";" & Err.Description
Resume ErrorExit
End Sub [code] [/ code]
Thank you for your understanding and patience
Nikolino
I know I don't know anything (Socrates)