excel - convert xlsx file to csv -
i trying find fast way save xlsx files csv files same filename xlsx file (just in csv format). have recorded macro shortcut, issue whenever try new file saves same filename recorded initial macro (i.e. see below, because have file labelled in code as: 3wdl_1 (2014-08-07)10secdatatable sit.csv
). there need replace 3wdl_1 (2014-08-07)10secdatatable sit.csv
make macro save same filename actual workbook working with.
so have folder full of xlsx files , want use shortcut/macro on each xslx file convert them csv files have same name original xlsx file, , saved same folder.
i need replace 3wdl_1 (2014-08-07)10secdatatable sit.csv
portion of code work new xlsx file open up. otherwise may old fashioned way mouse
thanks in adcance,
paddy
sub saveascsvfile chdir "c:\users\paddy\desktop\new csv files whole cgm date ok!" activeworkbook.saveas filename:= _ "c:\users\paddy\desktop\new csv files whole cgm date ok!\" & _ "3wdl_1 (2014-08-07)10secdatatable sit.csv", _ fileformat:=xlcsvmac, createbackup:=false end sub
to file name, use: activeworkbook.name path, use: activeworkbook.path
something should work well:
activeworkbook.saveas filename:= activeworkbook.path & "\" & _ replace(activeworkbook.name, "xslx", "csv"), _ fileformat:=xlcsvmac, createbackup:=false
Comments
Post a Comment