Excel精英培训网

 找回密码
 注册
数据透视表40+个常用小技巧,让你一次学会!
查看: 1609|回复: 1

.xlsm转.csv

[复制链接]
匿名  发表于 2015-1-16 09:29 |阅读模式
给位高手,在下要把.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

excel精英培训的微信平台,每天都会发送excel学习教程和资料。扫一扫明天就可以收到新教程
匿名  发表于 2015-1-16 14:51
回复

使用道具

您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|Archiver|Excel精英培训 ( 豫ICP备11015029号 )

GMT+8, 2024-6-6 08:19 , Processed in 1.438913 second(s), 9 queries , Gzip On, Yac On.

Powered by Discuz! X3.4

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表