美文网首页
XLSX批量转化成CSV

XLSX批量转化成CSV

作者: 红梅素_2 | 来源:发表于2022-04-16 18:48 被阅读0次

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

相关文章

网友评论

      本文标题:XLSX批量转化成CSV

      本文链接:https://www.haomeiwen.com/subject/tupxtctx.html