给位高手,在下要把.xlcsv转成.csv,但运行程序后,里面日期从 yyyy/mm/dd 变成了 mm/dd/yyyy. 请问有没有解决方法不让日期格式改变?
(在下添加 local:=true后,日期不变了,但是里面的数据又变了,比如,0.56变成 0;56 , 我是想转换成.csv后的所有东西都保持和以前一样)
万分感谢
Sub Go_Save() Set wb = ActiveWorkbook strPath2 = wb.Path & "\" & Left(wb.Name, Len(wb.Name) - 4) & "csv" strPath3 = wb.Path & "\old\aaa.csv" Kill strPath3 wb.Save wb.SaveAs strPath2, FileFormat:=xlCSV, CreateBackup:=False wb.SaveAs strPath3, FileFormat:=xlCSV, CreateBackup:=False intFile = FreeFile Open strPath2 For Input As intFile lngChars = LOF(intFile) strImport = Input(lngChars - 2, intFile) Close #intFile outFile = FreeFile() Open strPath2 For Output As outFile Print #outFile, Replace(Replace(strImport, ",", ";"), ".", ",") Close #outFile wb.Close savechanges:=False End Sub
|