I use GridExtras which is available on the SPS site and has CopyToExcel in its GridExtrasProcs.prg
Not sure if you have the exact same version or file but this code works for me:
CREATE CURSOR ctest (cName c(10)) INSERT INTO ctest VALUES ("gene") INSERT INTO ctest VALUES ("frank")
SET PROCEDURE TO gridextrasprocs m.lcFileName = "d:\temp\test.xlsx" IF FILE(m.lcFileName) ERASE (m.lcFileName) ENDIF
IF copytoexcel(m.lcFileName, "Sheet1", "ctest", "Name", "cTest.cName") MESSAGEBOX("Excel file created") ELSE MESSAGEBOX("Failed") ENDIF
Frank.
Frank Cazabon
On 06/11/2019 08:44 PM, Gene Wirchenko wrote:
At 13:41 2019-11-06, Frank Cazabon frank.cazabon@gmail.com wrote:
What parameters did you pass in? The syntax is: CopyToExcel("C:\Test.xlsx", "Sheet1", "MyTable") This is the header of the Function in the GridExtrasProcs.prg that I have and use: FUNCTION CopyToExcel(tcXLSFile, tcSheet, tvWorkArea, tcExcelFieldList, tcTableFieldList, tcTableForExpr)
Yup. I specified the spreadsheet (tried no directory and with directory), a sheet name (both "export" and "Sheet1"), and both a filename and an alias.
All I get is an empty spreadsheet, and the return value is 0 every time. No error messages either.
[snip]
Sincerely,
Gene Wirchenko
[excessive quoting removed by server]