我把一个Variant数组 Publicoutput存到一个txt文件中      
Open FileName For Output As #1
        For j = 0 To UBound(Publicoutput, 1)
        For i = 0 To UBound(Publicoutput, 2)
        Write #1, Publicoutput(j, i)
        Next i
        Next j
        Close #1但是我想在打开文件的时候把它取出来,把这个数组取出来怎么办?关键不知道这个组有多大?

解决方案 »

  1.   

    用redim 动态改变数组下标,每循环一次就加1,还要注意保持数组内容。
      

  2.   

    dim aa() as string
    Open App.Path & "\aaa.txt" For Input As #1
      Do While Not EOF(1)
        Input #1, sFile
        WMP1.currentPlaylist.appendItem WMP1.newMedia(sFile)
      Loop
      Close #1
      

  3.   

    呵呵还没有改完就发了,也可以先读取到一个变量里,最后用split函数分割,那样效率应该更高。
      

  4.   

    dim aa() as string
    dim bb as string
    dim cc as string
    Open App.Path & "\aaa.txt" For Input As #1
      Do While Not EOF(1)
        Input #1, bb
        cc = cc + ";" + bb
      Loop
    Close #1
    aa =split(cc,";")
      

  5.   

    为什么我保存了txt文件之后再用Open App.Path & "\aaa.txt" For Input As #1,txt文件里的东西就消除了呢?