簡體   English   中英

粘貼到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 

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM