Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Checking whether a file is open in Excel
Message
From
01/04/2006 11:36:00
 
 
To
30/03/2006 09:37:55
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Environment versions
Visual FoxPro:
VFP 9
OS:
Windows XP
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01109158
Message ID:
01109758
Views:
30
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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform