Previously opened Excel / Word files.

Post Reply
Natter
Posts: 524
Joined: Mon May 14, 2007 9:49 am

Previously opened Excel / Word files.

Post 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 ?
User avatar
MarcoBoschi
Posts: 925
Joined: Thu Nov 17, 2005 11:08 am
Location: Padova - Italy
Contact:

Re: Previously opened Excel / Word files.

Post 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
Marco Boschi
info@marcoboschi.it
Natter
Posts: 524
Joined: Mon May 14, 2007 9:49 am

Re: Previously opened Excel / Word files.

Post by Natter »

Thanks !
Post Reply