请问excel宏把数据表转成txt

2024-12-14 16:54:29
推荐回答(2个)
回答1:

Dim excel As Object
Set excel = CreateObject("excel.application")
'--------------这上面可不看照抄
excel.workbooks.Open ("C:\abc.xls")
excel.Visible = True
Open "C:\abc1.txt" For Append As #1
Print #1, excel.Sheets(1).Name
Close #1
Open "C:\abc2.txt" For Append As #2
Print #2, excel.Sheets(2).Name
Close #2
Open "C:\abc3.txt" For Append As #3
Print #3, excel.Sheets(3).Name
Close #3
excel.activeworkbook.save
excel.quit

回答2:

参考一下Workbook.SaveAs 方法