Hi,
I am using FSO in the following way to read the content of 2 files into 2 string variables.
Is this correct or can I create a FSO just once and read both files into separate variables in the same code block?
Also when writing data to a file is complete the file is normally closed. Can I read the file content to a variable without closing the file?
- Either using FSO or Print?
I am using FSO in the following way to read the content of 2 files into 2 string variables.
Is this correct or can I create a FSO just once and read both files into separate variables in the same code block?
Also when writing data to a file is complete the file is normally closed. Can I read the file content to a variable without closing the file?
- Either using FSO or Print?
Code:
'Create FileSystemObject for reading Arr.txt file content to strArr
Set fso = CreateObject("Scripting.FileSystemObject")
oFile = CurrSampleFile
Set f = fso.OpenTextFile(oFile, 1)
strArrI = f.ReadAll
f.Close
Set ts = Nothing
'Create FileSystemObject for reading ArrT.txt file content to strArrT
Set fso = CreateObject("Scripting.FileSystemObject")
oFile = TempSampleFile
Set f = fso.OpenTextFile(oFile, 1)
strArrT = f.ReadAll
f.Close
Set ts = Nothing