简体   繁体   中英

paste into a txt file without overwriting

hi i am trying to paste some data from a website into a txt doc, is it possible to paste on a new line without overwritting the file? this is my code,

 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 

From http://www.w3schools.com/asp/met_opentextfile.asp ,
it looks like if you change
Set f = fso.OpenTextFile("output.txt", 2, True,utf-2)
to
Set f = fso.OpenTextFile("output.txt", 8, True,utf-2)
it will append to the end of the file instead of overwrite.

得到它了

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM