>Hi,
>
>I have a program that copies a table to excel format. Sometimes the client has a previous version of the spreadsheet open and VFP cannot create a new file of the same name. At this point I get the error 1111 Invalid File Descriptor.
>
>There is probably a way of determining if a file is open by another application, before trying to create a new one of the same name.
>
>Any ideas,
>
>
>Paul
Paul,
You could check it with lowlevel functions (fopen(), fcreate()) :
lcExcelFile = "c:\myPath\myExcel.xls"
handle = fopen(lcExcelFile,12)
if handle < 0 and ferror() = 5
else
=fclose(handle)
endif
But what I prefer is to create xls file with a unique name :
lcTempXLSFile = sys(2015)+".xls"
Cetin