ubject: Re: Checking if an object is available
Initialize the MyFile variable as Nothing and reset it to Nothing
after every close. You're getting the error that it's not defined
because it isn't.
Hth,
Tom
On 11/26/2011 4:44 PM, David wrote:
In one of my apps, I am trying to fi
Tom and Aaron,
thanks. Works like a dream. We all still are learning. Smile.
- Original Message -
From: "Tom Kingston"
To:
Sent: Saturday, November 26, 2011 11:02 PM
Subject: Re: Checking if an object is available
Initialize the MyFile variable as Nothing and reset it
You could check the TypeName of MyFile:
If TypeName(MyFile) <> "Empty" Then
blah
End If
Alternatively, and probably best practice, would be to initialize the
MyFile object to Nothing when you declare it.
For example, wherever you Dim MyFile, instead do:
Dim myFile : Set myFile = Nothing
Initialize the MyFile variable as Nothing and reset it to Nothing after
every close. You're getting the error that it's not defined because it
isn't.
Hth,
Tom
On 11/26/2011 4:44 PM, David wrote:
In one of my apps, I am trying to figure a way to perform the following; if
such is possible, th
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