In one of my apps, I am trying to figure a way to perform the following; if 
such is possible, that is.

I have a FileSystemObject defined as FS. Then somewhere in the code, I have a 
line like:
Set MyFile = FS.OpenTextFile( "test.txt", 1, False)
This to open a textfile object, in the Object MyFile.

A third place in the code, I want to check if the MyFile object is active. If 
it is, I want to have it closed.
I tried this:
If Not MyFile Is Nothing Then    MyFile.Close

This works in some cases, but other times I am getting an error message, saying 
the object is undefined. Seems to me, if the object has been in use once, it 
works, but not if there has been no call for the object through the process.

OK, so my Question:
Is there any way for me, to check to see if an object has been defined, and is 
active? Some way, that will not leave me with an error message?

Thanks for any idea.

Reply via email to