>This works:
>
>lc_xls = "C:\myfile.xls"
>lc_fileldlist = "invno, invdte, invamt"
>COPY TO (lc_xls) FIELDS &lc_fieldlist TYPE xl5
>
>This gives a syntax error:
>lc_xls = "C:\myfile.xls"
>lc_fileldlist = "invno, invdte, invamt"
>COPY TO (lc_xls) FIELDS (lc_fieldlist) TYPE xl5
>
>Why?
() are used for "name", such as field 'name', table 'name', alias 'name', file 'name' ...
m.lc_fieldlist is not a 'name' but a comma separated list of fields.
PS: Instead of using type xl5 it is better to use something like VFP2Excel function (I have posted many samples before).