Hi Albert,
depends on the version of Excel. If you can safely assume that Office XP or later is used, I would avoid automation completely. Excel XP, Excel 2003 and Excel 2007 allow to save spreadsheets in XML files. It's way simpler than automation to merely open the XLS file given by your client, save it as an XML spread sheet and replace all cell values with textmerge expressions. Then use something like TEXTMERGE(FILETOSTR()) to generate the entire spreadsheet in a single line. To view it in Excel, you can use a line like this:
Local loExcel, lcFile
lcFile = FullPath("Test.xml")
StrToFile( m.lcXML, m.lcFile)
loExcel = CreateObject("Excel.Application")
loExcel.Visible = .T.
Try
loExcel.Workbooks.Add(m.lcFile)
Catch
EndTry
--
Christof