Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Checking whether a file is open in Excel
Message
De
01/04/2006 11:36:00
 
 
À
30/03/2006 09:37:55
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Versions des environnements
Visual FoxPro:
VFP 9
OS:
Windows XP
Database:
Visual FoxPro
Divers
Thread ID:
01109158
Message ID:
01109758
Vues:
28
Hi all,

Dear Cetin,

Thanks very much for the code, for which I adapted Jojo's and yours to suit my needs.

However, there is no consistent behaviour.

On starting VFP, the code shown below works fine returning the correct values, fopen=(-1) if a file is open. But on closing the excel file, and re-running the prog, it continues to return -1, showing the file is open, when it is'nt.

On exiting VFP and restarting, and rerunning the same programme, it again works fine, only for one instance.
lcFile = 'c:\devstudio\panorama\PTYG.xls'
STORE FOPEN('&lcfile',12) TO lnfilestatus
WAIT WINDOW lnfilestatus
IF lnfilestatus = -1 &&FOPEN('&lcFile',12) = -1
	MESSAGEBOX('File is already open!',0+16,'',1500)
	FCLOSE('&lcfile')
Else
	MESSAGEBOX("File is NOT open")
Endif
Thanks, Cetin,

Regards,

Steve
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform