What is the test for whether a file is open?
Are you talking about a workbook file (as Mike understood) or a text file
(as I understood). If the latter are you talking about opening the textfile
in Excel, some text editor or with the Open filenumber statement
Regards,
Peter T
"Jim Luedke" wrote in message
...
Thanks both for reply.
***
Peter:
My VBA function is the only entity that ever opens the file. So my
question is, and I probably should've been more explicit:
What is the test for whether a file, *which only you yourself ever
open, inside VBA*, is currently open?
***
Mike:
Thanks very much for code. I'll give it a try.
But, are you saying that VBA has no expression telling you whether a
file *it itself* opened, is open or not? That seems odd to me.
Somewhere along the line I got the impression that you could, maybe,
test the file handle or something. If H is the handle, does something
like this work?
If H = 0 then
IKnowThatFileIsClosed = True
End If
On the other hand, when I put a trace on:
Close #H
it seems that the value of H doesn't change, i.e. become 0, on
closing. I thought it did. So I must be all wet.
Thanks much again.
***
|