>Dear Borissov,
>
>Thanks for all the help. I do not know how I put in that fclose() at that point. I was experimenting with various permutations and combinations, and inadvertently sent in that piece of code to you. Feels stupid, all the same..!
>
>But you were right about placement of the fclose()
>
>I have presently adapted Cetins code, with your fclose() location suggestion, and got the right result. My final code is below:
>
>
>lnHandle = fopen('c:\devstudio\panorama\PTYG.xls',12)
>if m.lnHandle > 0
> MESSAGEBOX("File is NOT open")
>else
> lInUse = .t.
> MESSAGEBOX("File is open")
>ENDIF
>fclose(m.lnHandle)
>
>
>With best regards,
>
>Steve.
Steve,
For a moment I thought if it was me who placed fclose() wrongly:) Why do you need to 'adapt' the code I wrote, it was already clear (except file's name):
local lInUse
lnHandle = fopen("c:\myPath\myFile.xls",12)
if m.lnHandle > 0
fclose(m.lnHandle)
else
lInUse = .t.
endif
MessageBox( "File is"+ iif(m.lInUse,""," NOT") + " open." )
Cetin