读取文本中的内容,注意是txt 或者word中的内容,不是text控件中的,要识别回车符,也就是读取之后用SPLIT()得到回车符,具体方法 请教~!!!VB code: Set o = GetObject("", "Scripting.FileSystemObject").OpenTextFile("a.bat") Do Until o.AtEndOfStream MsgBox o.ReadLine() Loop
filenum% = FreeFile Open CommonDialog1.FileName For Input As #filenum Input #filenum, a y = Split(a, "vbcrlf") DataBaseForm.Text1.Text = y(0) & "1111" & y(1) 具体代码,Y(1)经常下标越界,说明无法识别VBCRLF ,帮帮忙 ,在线等~ 按行读取使用就可以了
Private Sub Command1_Click() dim a() as string Dim i As integer Open App.Path & "\1.txt" For Input As #1 Dim Lstr As String Do While Not EOF(1) Line Input #1, Lstr i=i+1 redim preserve a(i) a(i)=lstr MsgBox a(i) Loop Close #1 End Sub