Set fs = CreateObject("Scripting.FileSystemObject")
    Set a = fs.CreateTextFile("c:\123.txt", True)
    a.WriteLine("This is a test.")
    a.Close
    Set a = nothing
    Set fs = nothing

解决方案 »

  1.   

    Open "123.txt" For Output As #1
        Close #1
      

  2.   

    如果时间里其他类型的文件呢?
    比如excel文件等。
    msdn 中有没有解说?查哪个关键词?
      

  3.   

    以上的方法都可以实现,但是我还是喜欢用文件系统对象
    代码如下:
    set fs=createobject("scripting.filesystemobject")
    set a=fs.createtextfile( app.path & "123.txt",true)
    a.writeline "this ia a document."
    set a=nothing
    set fs=nothing
    用文件系统还可以建立很多对象(目录,文件等等)
      

  4.   

    Set excelApp = CreateObject("excel.application")
        excelApp.Visible = True
        Set excelBook = excelApp.workbooks.Add
        Set excelSheet = excelApp.worksheets(1)
        .....