Excel批量转化CSV (转载)

链接:https://zhuanlan.zhihu.com/p/52458010

 

Sub xls2csv()
     Application.DisplayAlerts = False
     t = ActiveWorkbook.Name
     mypath = ActiveWorkbook.Path & "\"
     myfile = Dir(mypath & "*.xls")
     Do Until Len(myfile) = 0
           If myfile <> t Then
              Workbooks.Open Filename:=mypath & myfile
              ActiveWorkbook.SaveAs Filename:=mypath & Left(myfile, InStr(myfile, ".") -    1) & ".csv", FileFormat:=xlCSV
     End If
     If myfile <> t Then ActiveWorkbook.Close
     myfile = Dir
 Loop
 Application.DisplayAlerts = True
End Sub

 

posted @ 2020-09-17 16:28  redufa  阅读(706)  评论(0)    收藏  举报