Hello,
I am trying to understand how to read a text line to an inputbox. I have this code that will create the text file from the inputbox, but then I want to read that same line when I run the script again. I keep getting an error that says "Input past end of file". I am sure I have something out of order.... any help would be great!
I am trying to understand how to read a text line to an inputbox. I have this code that will create the text file from the inputbox, but then I want to read that same line when I run the script again. I keep getting an error that says "Input past end of file". I am sure I have something out of order.... any help would be great!
Code:
Const ForReading = 1, ForWriting = 2, ForAppending = 8, CreateIfNeeded = true
set fso = CreateObject("Scripting.FileSystemObject")
set file = fso.OpenTextFile("output.txt", ForWriting, CreateIfNeeded)
dim fname
Set objFileToRead = CreateObject("Scripting.FileSystemObject").OpenTextFile("C:\\temp\\output.txt",1)
strText = objFileToRead.ReadAll()
fname = inputbox("Enter some text", strText)
Set objFileToRead = Nothing
file.write fname
objFileToRead.Close
file.close