Previously opened Excel / Word files.

Previously opened Excel / Word files.

Postby Natter » 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 ?
Natter
 
Posts: 1215
Joined: Mon May 14, 2007 9:49 am

Re: Previously opened Excel / Word files.

Postby MarcoBoschi » 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
User avatar
MarcoBoschi
 
Posts: 1065
Joined: Thu Nov 17, 2005 11:08 am
Location: Padova - Italy

Re: Previously opened Excel / Word files.

Postby Natter » Thu Jan 14, 2021 1:16 pm

Thanks !
Natter
 
Posts: 1215
Joined: Mon May 14, 2007 9:49 am


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: nageswaragunupudi and 106 guests