我需要從我的excel表格導出數據到csv。我有這樣的代碼。但我的Excel數據中的一些列中有公式。所以,出口到「csv」時,我得到的是「0」而不是價值。使用pastespecial將excel數據複製到csv中
是否有對csv的pastespecial支持?!或者以任何其他方式將單元格值導出爲csv。
我當前的代碼是:
Sub submit_task()
'
' submit_task Macro
'
'
Dim Filename As String
Dim WB As Workbook
Application.DisplayAlerts = False
Filename = "Job_Details.csv"
'Copy the contents of required sheet ready to paste into the new CSV
Sheets("output_sheet").Range("A3:C4").Copy 'Define your own range
'Open a new XLS workbook, save it as the file name
Set WB = Workbooks.Add
With WB
.Title = "Job Details"
.Subject = "Task Submitted"
.Sheets(1).Select
ActiveSheet.Paste
.SaveAs "C:\UI\" & Filename, xlCSV
.Close
End With
Application.DisplayAlerts = True
End Sub
嘗試用'ActiveSheet.Range( 「A1」)。PasteSpecial的xlPasteValues' – Slai