craigachan
Registered User.
- Local time
- Today, 10:10
- Joined
- Nov 9, 2007
- Messages
- 285
I have a Test.txt file that is already open. I want to close it with the following code:
Can someone tell me why this code does not work?
Thank you.
Code:
Dim objfso
Dim objfile
dim strfilepath as string
strfilepath = "C:\mydir\test.txt"
'===Following does not close txt file
Set objfso = CreateObject("Scripting.FileSystemObject")
Set objfile = objfso.OpenTextFile(strfilepath, 1)
objfile.Close
Can someone tell me why this code does not work?
Thank you.