Hi all,
I have a macro that is taking the complete path and name of a .csv file that is in A4 and then is making a copy of that file and save it to another location and also renames the csv file.
The problem I have is, that the new csv file created is a mess. All the values I had in individual columns in the original file, appear all together in one column in the new file....
Is there a way to keep the same csv column organization from the original file to the new one please?
By the way, it is a must to copy and paste the file to another location without opening the original file, because it might be in use. I say this because surfing the net I saw other macros that are opening and saving as the file, but I can't do this.
I attach you my actual code
Sub CopyAndRenameFile()
Dim oFSO As Object
Dim FilePathAndName As String
'Takes the path and name of csv file in A4
FilePathAndName = Sheets("Sheet1").Range("A4")
Set oFSO = CreateObject("Scripting.FileSystemObject")
'Copy the file in A4 and save it and rename it to another location
Call oFSO.CopyFile(FilePathAndName, "C:\Users\user\Desktop\Data.csv")
End Sub
Bookmarks