粘贴到txt文件而不覆盖

时间:2015-07-02 16:40:18

标签: vbscript

您好我想将网站上的一些数据粘贴到txt文档中,是否可以粘贴新行而不覆盖文件? 这是我的代码,



Set app = CreateObject("Shell.Application")
For Each window In app.Windows()
  If InStr(1, window.FullName, "iexplore", vbTextCompare) > 0 Then
    Set ie = window
    Exit For
  End If
Next

Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.OpenTextFile("output.txt", 2, True,utf-2)
f.Write ie.Document.All.Item("resltext").innerText
f.Close




2 个答案:

答案 0 :(得分:1)

来自http://www.w3schools.com/asp/met_opentextfile.asp
看起来好像你改变了     设置f = fso.OpenTextFile(“output.txt”,2,True,utf-2)
到     设置f = fso.OpenTextFile(“output.txt”,8,True,utf-2)
它将附加到文件的末尾而不是覆盖。

答案 1 :(得分:0)

got it

f.WriteLine ie.Document.All.Item("resltext").innerText

相关问题