ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Including .csv to end of filename (https://www.excelbanter.com/excel-programming/289589-including-csv-end-filename.html)

Jeff Armstrong

Including .csv to end of filename
 
Hello,

I have a macro that imports all the filenames from a
folder into column A. These files have the "." character
in their name. This is how the data comes to me and I
can't change it. The problem with this is that I want to
open and save each file as a CSV file. When I do this it
doesn't include the extension. I am assuming that this is
because it doesn't like the ".". The problem with this is
that later in the macro when I go back to open up the CSV
file I get the message notifying me that this file may
contain viruses and do I want to open this file? It also
puts all the data into column A rather than separate it by
the comma delimiter. I can manually add the extension to
the files by renaming each file and this fixes the problem
but there are 304 files and this data gets refreshed
weekly. Is there a way that I can automatically add the
extenstion to the end of the file when I save the each
file after importing and opening? Below is the current
statement that I use.

ActiveWorkbook.SaveAs Filename:="C:\Excel_Data\" _
& FileName, FileFormat:=xlCSVMSDOS



All times are GMT +1. The time now is 06:57 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com