各位大侠:    我想创建一个文件夹,我的程序是这样写的,我首先建立了一个fso,然后创建了这个文件Private Sub Command1_Click()
Dim fso As New FileSystemObject
Dim f1 As File
Set f1 = fso.CreateTextFile("d:\textfile.txt")
End Sub运行程序后,在D盘创建textfile.txt文件成功,但是程序上提示我出错,说“实时错误13,类型不匹配”,请各位指条明路

解决方案 »

  1.   

    Dim fso As New FileSystemObject
    Dim f1 As TextStream
    Set f1 = fso.CreateTextFile("d:\textfile.txt")
      

  2.   

    Member of Scripting.FileSystemObject
        Create a file as a TextStreamFunction CreateTextFile(FileName As String, [Overwrite As Boolean = True], [Unicode As Boolean = False]) As TextStream
      

  3.   

    学会用对象浏览器,再vb里按F2,你看微软多重视他啊!
      

  4.   

    Private Sub Command1_Click()
    Dim fso As New FileSystemObject
    Dim f1 As TextStream
    Set f1 = fso.CreateTextFile("d:\textfile.txt")
    End Sub
      

  5.   

    CreateTextFile 返回的是一个 TextStream 类型的东东