Page 1 of 1

Previously opened Excel / Word files.

Posted: Thu Jan 14, 2021 10:42 am
by Natter
Hi,

II am creating an Excel / Word object (via OLE) and want to open a file. How can I determine that this file is already open by someone ?

Re: Previously opened Excel / Word files.

Posted: Thu Jan 14, 2021 12:53 pm
by MarcoBoschi
simply try to open in exclusive mode before
#include "FileIO.ch"

FUNCTION MAIN( cFile )
LOCAL nHandle

nHandle := FOPEN( cFile , FO_EXCLUSIVE )
IF nHandle = -1
? "Error" , FERROR()
ELSE
? "nHandle" , nHandle
FCLOSE( nHandle )
ENDIF

RETURN NIL

Re: Previously opened Excel / Word files.

Posted: Thu Jan 14, 2021 1:16 pm
by Natter
Thanks !