Hi all,
Dear Cetin,
Thanks very much for the code, for which I adapted Jojo's and yours to suit my needs.
However, there is no consistent behaviour.
On starting VFP, the code shown below works fine returning the correct values, fopen=(-1) if a file is open. But on closing the excel file, and re-running the prog, it continues to return -1, showing the file is open, when it is'nt.
On exiting VFP and restarting, and rerunning the same programme, it again works fine, only for one instance.
lcFile = 'c:\devstudio\panorama\PTYG.xls'
STORE FOPEN('&lcfile',12) TO lnfilestatus
WAIT WINDOW lnfilestatus
IF lnfilestatus = -1
MESSAGEBOX('File is already open!',0+16,'',1500)
FCLOSE('&lcfile')
Else
MESSAGEBOX("File is NOT open")
Endif
Thanks, Cetin,
Regards,
Steve