If this is your first visit, be sure to
check out the
FAQ
by clicking the
link above. You may have to
register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.
im trying to save a website html into a text document without it asking me were to save and if its ok to overwrite this is what i have been using
web.Document.execCommand "SaveAs", False, "data.text"
it works but i need it to not ask me were to save it to any ideas/help?
You can't stop the SaveAs box from appearing. Only way would be using a timer and FindWindow. When that window is found, generate keystroke by a simple SendKeys or
keyb_event
/
PostMessage
.
But this method is not very good.
to save the webpage as plain text and as html (without images and styles) you can do this,
VB Code:
Private Sub Command1_Click()
Dim Ftxt As Integer
Dim Fhtm As Integer
'-----------------
Ftxt = FreeFile
Open "C:\data.txt" For Output As #Ftxt
Print #Ftxt, WebBrowser1.Document.body.InnerText 'Saves as text
Close #Ftxt
'-----------------
Fhtm = FreeFile
Open "C:\data.htm" For Output As #Fhtm
Print #Fhtm, WebBrowser1.Document.body.InnerHTML 'Saves as HTML
Close #Fhtm
End Sub
You can directly download the file by
URLDownloadToFile.shtml
To silently save the document with images etc, you'll need to either string parse the document to get the images urls
or better, do the way IE does - loop through DOM, get the image addresses, look for them in cache. If they are found in cache, copy them. Otherwise, download them.
thanks i dont need the images or anything my program just saves the page as html then searches thrue it for keywords
edit: that worked perfectly thanks
Advertiser Disclosure:
Some of the products that appear on this site are from companies from which TechnologyAdvice receives compensation. This compensation may impact how and where products appear on this site including, for example, the order in which they appear. TechnologyAdvice does not include all companies or all types of products available in the marketplace.