Hi everyone,
I curious about the excel writing codes from microsoft site (see below - I added the temp folder bit).The code asks for the "saveas" to exist for the code to work. I just want to create an excel file with some data inside it and let the user decide whether to save the file or not. if the file is saved by default I need to delete the file every time the code is run. Could anyone tell me how to write an excel file (from onclick event) and not need to save it?
Code:
Set FS = CreateObject("Scripting.FileSystemObject")
'Debug.Print FS.GetSpecialFolder(2)
Set Excel = CreateObject("Excel.Sheet")
Excel.Application.Visible = True
Excel.Application.Cells(1, 1).Value = "test"
Excel.SaveAs FS.GetSpecialFolder(2) & "\SumExcelOutput.xls"
Excel.Application.Quit
Set Excel = Nothing