Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Checking whether a file is open in Excel
Message
From
03/04/2006 07:17:21
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
02/04/2006 12:52:27
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:
01109894
Views:
52
>Dear Borissov,
>
>Thanks for all the help. I do not know how I put in that fclose() at that point. I was experimenting with various permutations and combinations, and inadvertently sent in that piece of code to you. Feels stupid, all the same..!
>
>But you were right about placement of the fclose()
>
>I have presently adapted Cetins code, with your fclose() location suggestion, and got the right result. My final code is below:
>
>
>lnHandle = fopen('c:\devstudio\panorama\PTYG.xls',12)
>if m.lnHandle > 0
>	MESSAGEBOX("File is NOT open")
>else
> 	lInUse = .t.
>	MESSAGEBOX("File is open")
>ENDIF				
>fclose(m.lnHandle)
>
>
>With best regards,
>
>Steve.

Steve,
For a moment I thought if it was me who placed fclose() wrongly:) Why do you need to 'adapt' the code I wrote, it was already clear (except file's name):
local lInUse
lnHandle = fopen("c:\myPath\myFile.xls",12)
if m.lnHandle > 0
 fclose(m.lnHandle)
else
 lInUse = .t.
endif
* add messagebox here
MessageBox( "File is"+ iif(m.lInUse,""," NOT") + " open." )
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform