Dim text As String
Dim i As Integer
Dim a() As String
Private Sub Command1_Click()
text = ""
CommonDialog1.FileName = ""
CommonDialog1.Filter = "文本文件.txt|*.txt"
CommonDialog1.ShowOpen
If CommonDialog1.FileName <> "" Then
Open CommonDialog1.FileName For Input As #1
Do While Not EOF(1)
Line Input #1, demo
text = text & vbCrLf & demo
Loop
End If
Close #1
End Sub
Private Sub Command2_Click()
a = Split(text, vbCrLf)
If i < UBound(a) Then
Text1.text = i + 1
Text2.text = a(i + 1)
Clipboard.Clear
Clipboard.SetText (Text2.text)
i = i + 1
End If
End Sub