Hilmar,
PMFJI, below is an extract from a class that does exactly this. Basically, the generated Excel sheet is copied using the Copy method and the original workbook is closed. In my case, I delete the temp file and leave it up to the user to save or discard the generated Excel file. If you want to keep the original file, simply comment the DELETE FILE line.
oXLS = CREATEOBJECT("Excel.Application")
loWkBk = oXLS.Application.Workbooks.Open(lcExcelFile)
oXls.Application.DisplayAlerts = .f.
loWkBkTmp = oXls.workbooks.Add()
loWkBk.ActiveSheet.Copy(loWkBkTmp.Sheets(1))
loWkBk.Close()
This.ioApi.sleep(500)
IF FILE(lcExcelFile)
DELETE FILE (lcExcelFile)
ENDIF
oXls.Application.DisplayAlerts = .t.
oXls.visible = .t.
HTH
>>If the sheets are not large, you might want to think about using Excel automation to populate and name the sheet for you; put the data into your XLS spreadsheet, open a new workbook using automation, and then copy the XLS (or DBF - Excel can read a DBF file) into the proper cells, or open the XLS you create using automation and then rename it via Save As before exposing it to the user to edit.
>
>The problem here is that the "Save" command still won't be disabled - I only want the user to have access to the file to have a filename - IOW, if the user presses "Save", I want the "SaveAs" dialog to appear; I do not want the user to overwrite some temporary filename.
>
>I was looking for some "Insert from File" command, but this seems to be available only in MS-Word, not in Excel.
>
>Hilmar.
Daniel