-
I have this statement:
Open App.Path + "\Notepad.txt" For Input As #1
Input #1, Text1.Text
Close #1
Every time I run it, it tells me that:
Variable is Required, can not assign to this expression
And it highlights Text1.Text
what does that mean?
its really annoying
its not working
HELP!
-
The problem is that the Input statement does not allow any extra work to be done in its procedure, this includes reading a property of a control. Do the following to amend your problem:
Code:
Dim sData As String
Dim iFileNum As Integer
iFileNum = FreeFile
Open App.Path & "\Notepad.txt" For Input Access Read Shared As #iFileNum
Input #iFileNum, sData
Close #iFileNum
Text1.Text = sData
It will work that way now, however, use the following for a better and more efficient results:
Code:
Dim iFileNum As Integer
iFileNum = FreeFile
Open App.Path & "\Notepad.txt" For Input Access Read Shared As #iFileNum
Text1.Text = Input(LOF(iFileNum), #iFileNum)
Close #iFileNum
Later.