I am attempting to create an Excel spreadsheet from within a VB6 application thus…
Set xl = New Excel.application
Set xlwbook = xl.Workbooks.Open(file_name)
Set xlsheet = xlwbook.Sheets.Item(1)
followed by
xlsheet.Cells(1, 1) = "Blah blah blah"
and so on.
I specifically want to create a new file every time this operation is performed. At the moment it returns a file not found error.
I’d like to know if this is the right approach, and if so, how I can request that a new file be created by the .Open method (or whatever method I should be using).
OPEN implies an existing sheet that you are trying to open.
You should be creating a new sheet.
Try this
This will create an unsaved sheet. Once you are done with all the work, you have to save it.