粘贴到txt文件中而不覆盖

paste into a txt file without overwriting

您好,我正在尝试将网站上的一些数据粘贴到 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

来自 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)
它将附加到文件的末尾而不是覆盖。

知道了

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