FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Previously opened Excel / Word files.
Posts: 1392
Joined: Mon May 14, 2007 09:49 AM
Previously opened Excel / Word files.
Posted: Thu Jan 14, 2021 10:42 AM

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 ?

Posts: 1091
Joined: Thu Nov 17, 2005 11:08 AM
Re: Previously opened Excel / Word files.
Posted: Thu Jan 14, 2021 12:53 PM

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
Posts: 1392
Joined: Mon May 14, 2007 09:49 AM
Re: Previously opened Excel / Word files.
Posted: Thu Jan 14, 2021 01:16 PM

Thanks !

Continue the discussion