View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Jim Luedke Jim Luedke is offline
external usenet poster
 
Posts: 43
Default What is the test for whether a file is open?

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.

***