Create an Excel file using vbscripts

前端 未结 5 1362
清歌不尽
清歌不尽 2020-12-29 12:36

How do I create an excel file using VBScript? I searched the net but it just mentions opening an existing file.

This is the extraction from the Internet

5条回答
  •  礼貌的吻别
    2020-12-29 13:37

    This code creates the file temp.xls in the desktop but it uses the SpecialFolders property, which is very useful sometimes!

    set WshShell = WScript.CreateObject("WScript.Shell")
    strDesktop = WshShell.SpecialFolders("Desktop")
    
    set objExcel = CreateObject("Excel.Application")
    Set objWorkbook = objExcel.Workbooks.Add()
    objWorkbook.SaveAs(strDesktop & "\temp.xls")
    

提交回复
热议问题