请教:1现在有一份.txt文件
怎样用excel实现 读取该.txt文件内容。。
检索 一个关键字 比如“ABC” 出现的次数。      2
现在如果有5个关键字,怎样循环检索。。得出这5个关键字出现的次数。。

解决方案 »

  1.   

    open "c:\1.txt" for input as #1
       s = input(1, lof(1))
    close #1
    msgbox "count of ABC = " & (len(s) - len(replace(s, "ABC", ""))) / 3
      

  2.   


    Open "TextBox1.Text" For Input As #1
      s = Input(1, LOF(1))
    Close #1
    MsgBox "count of ABC = " & (Len(s) - Len(Replace(s, "ABC", ""))) / 3
    End Sub
    怎么会报file not found   debug进去TextBox1.Text是有值的啊
      

  3.   

    Open TextBox1.Text把引去了。
      

  4.   

    Open "TXT文件" For Binary As #1
    Text1.Text = Input(LOF(1), 1)
    Close 1