Sub txttt()
On Error Resume Next
Dim myfile1, mypath1
myfile1 = Dir(app.path & "\in.txt", vbNormal)
If myfile1 = "in.txt" Then
GoTo 50
Else
Open app.path & "\in.txt" For Output As #1
Close #1
End If
50:
Open app.path & "\in.txt" For Input As #1
Dim txt1, txt2
Line Input #1, txt1 '读取第一行数据赋值到txt1
Line Input #1, txt2 '读取第二行数据赋值到txt2
Close #1
Text1.Text = txt1
Text2.Text = txt2
End Sub
Private Sub Command1_Click()
Dim s(1 To 100) As Integer
Dim i As Integer
Open App.Path & "\" & "in.txt" For Input As #1
For i = 1 To 100
Input #1, s(i)
Next i
Close #1
End Sub