Step1. 將要轉換的Excel檔案放在同一個檔案夾里,新建一個空白的Excel檔案,右擊左下角的Sheet 1,點擊“查看代碼”(WPS中為開發工具->VB編輯器)
Step2. 在出現的框里填上以下代碼,選中之后點擊運“運行”
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
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/293572.html
標籤:其他
上一篇:idea開發工具初始化相關設定
下一篇:AIoT讓一個屏有了100種用法
