|
-
Jun 13th, 2000, 11:04 PM
#1
Thread Starter
Hyperactive Member
I have the following simple code in my program:
Open "myfile.dat" for input as #1
Input #1, var1
Input #1, var2
Close #1
It is causing a "File Already Open Error" but my program MUST have this info refreshed every so often, but only when the File is closed, so not to cause the above error.
How can I detect if the file is open???
Something similar to this:
If FileAlreadyOpen = False then
Open "myfile.dat" for input as #1
Input #1, var1
Input #1, var2
Close #1
Else
MsgBox "File is Open"
End If
Thanks for any suggestions...
-
Jun 13th, 2000, 11:12 PM
#2
_______
just close it first
Close #1
then
open # 1
that way you know you got it.
"A myth is not the succession of individual images,
but an integerated meaningful entity,
reflecting a distinct aspect of the real world."
___ Adolf Jensen
-
Jun 13th, 2000, 11:43 PM
#3
New Member
The other option is to use the new FileSystemObject library. It can be found by selecting the Microsoft Scripting Runtime in the References... dialog box.
You should be able to test for Nothing...
-
Jun 13th, 2000, 11:54 PM
#4
Thread Starter
Hyperactive Member
Thanks for the help. The Close #1 before the Open #1 fixed it. I ASSUMED <-- (and became an ASS) that a Close #1 with no files open would generate an error. But it did'nt. Thanks guyz!
...later
[Edited by mikef on 06-14-2000 at 01:11 PM]
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|