[問題] VBA 將XLS轉CSV後,想同步改Sheet名稱
(若是和其他不同軟體互動之問題 請記得一併填寫)
軟體:excel
版本:2016
各位好,初入VBSA
參考版上的批量xls轉csv
做了一些修改
因為轉存的csv會依照原本xls檔名來取sheet名稱
能否轉出csv時,sheet的名稱想同步取名為"sheet0"
或者是能夠依照原本xls的sheet名稱同步移植過去?
Option Explicit
Sub Ex()
Dim xlpath As String, xlfile As String
Dim xlpathout As String
xlpath = "D:\研4\" '要轉檔路徑
xlpathout = xlpath & "csv\" '轉檔儲存路徑
MkDir xlpath & "csv\" '創轉檔存的資料夾
xlfile = Dir(xlpath & "*.xls")
Do While xlfile <> ""
With Workbooks.Open(xlpath & xlfile)
.SaveAs Filename:=xlpathout & Replace(xlfile, "xls", ".csv"),
FileFormat:=xlCSV
.Close SaveChanges:=True '關閉 檔案 ,存檔
End With
xlfile = Dir
Loop
End Sub
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 140.128.67.236
※ 文章網址: https://www.ptt.cc/bbs/Office/M.1532668200.A.0C3.html
→
07/27 13:26,
7年前
, 1F
07/27 13:26, 1F
→
07/27 13:27,
7年前
, 2F
07/27 13:27, 2F
→
07/27 13:29,
7年前
, 3F
07/27 13:29, 3F
→
07/27 13:29,
7年前
, 4F
07/27 13:29, 4F
→
07/27 13:35,
7年前
, 5F
07/27 13:35, 5F
Office 近期熱門文章
PTT數位生活區 即時熱門文章