第1个回答 2014-06-23
首先将Text1的MultiLine属性设为True Private Sub Command1_Click() Dim fso As Object, ts As Object Set fso = CreateObject("Scripting.FileSystemObject") Set ts = fso.OpenTextFile("d:\1.txt", 1) Do While ts.AtEndOfStream <> True Text1.Text = Text1.Text & ts.ReadLine & vbCrLf Loop ts.Close Set ts = Nothing Set fso = Nothing End Sub Private Sub Command2_Click() Dim fso As Object, ts As Object Set fso = CreateObject("Scripting.FileSystemObject") Set ts = fso.CreateTextFile("d:\2.txt", True) ts.Write Text1.Text ts.Close Set ts = Nothing Set fso = Nothing End Sub本回答被提问者采纳