如何用VBA批量处理,一次性把很多cvs格式的文件另存为exl格式文件

2022-07-30 社会 64阅读
使用下面代码可批量改后缀名
Sub 批量()
Dim wkb As Workbook
lj = "D:\"
dirname = Dir(lj & "\*.cvs")
Do While dirname <> ""
Set wkb = Workbooks.Open(lj & "\" & dirname)
dirname = Left(dirname, Len(dirname) - 3) & "xls"
wkb.SaveAs Filename:="D:\" & dirname, FileFormat:=xlWorkbookNormal
wkb.Close
Set wkb = Nothing
dirname = Dir
Loop
End Sub
声明:你问我答网所有作品(图文、音视频)均由用户自行上传分享,仅供网友学习交流。若您的权利被侵害,请联系fangmu6661024@163.com