创建excel文件
Sub addexcel(excelpath)
‘瀹氫箟excel瀵硅薄
Dim exlapp
‘瀹氫箟excel宸ヤ綔绨?
Dim exlworkbook
‘瀹氫箟excel宸ヤ綔琛?
Dim exlworksheet
‘鍒涘缓excel瀵硅薄
Set exlapp = CreateObject("excel.application")
‘鍒涘缓excel宸ヤ綔绨?
Set exlworkbook =exlapp.Workbooks.Add
‘鍒涘缓excel宸ヤ綔琛?
Set exlworksheet = exlapp.Worksheets.Add
‘濡傛灉excel瀛樺湪灏辨槸鐢╯ave锛屽鏋滄柊澧瀍xcel鍒欑敤saveas
exlworkbook.SaveAs(excelpath)
‘鍏抽棴excel宸ヤ綔绨?
exlworkbook.Close
‘閫€鍑篹xcel瀵硅薄
exlapp.Quit
Set exlapp =Nothing
Set exlworkbook =Nothing
Set exlworksheet =Nothing
End Sub
时间: 2024-10-11 18:13:13