I use this to create a new Excel workbook and then write data to it:
Set Excel = Sys.OleObject("Excel.Application")
Excel.Workbooks.Add
Excel.Visible = "True"
Excel.ActiveSheet.Name = ("Test") '<-- use to change name of active worksheet if desired
'.
'.
'.
'code here
' Write data to speadsheet with:
Excel.Cells(1,1) = "Test"
'.
'.
'.
' Saving Excel file
Excel.Application.DisplayAlerts = False '<-- suppresses any dialog boxes
Excel.Application.AlertBeforeOverwriting = False ' <-- suppresses any warniing about overwriting existing file
Excel.Application.ActiveWorkbook.SaveAs("D:\Test.xlsx") ' <-- Set save path and file name
Excel.Application.ActiveWorkbook.Close
Excel.Quit
Path can be predefined such as:
Path = "D:\Test_File\Test.xlsx"
Excel.Application.ActiveWorkbook.SaveAs(Path)
Notes: The path must exist otherwise the script fails.