Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

HOW TO SAVE COMPLETE HTML PAGE IN C:\MYDIR\

Status
Not open for further replies.
At least in Chrome: right-click on the page and select: Save As...

---- Andy

"Hmm...they have the internet on computers now"--Homer Simpson
 
Did you even try to Google it [ponder]
One simple search gives you many answers, one of them is this with code examples.

---- Andy

"Hmm...they have the internet on computers now"--Homer Simpson
 
othe way found...

but tghs code return nothing in Set topics = html.getElementsByClassName("comuni")

Public Sub parsehtml()

Dim http As Object, html As New HTMLDocument, topics As Object, titleElem As Object, detailsElem As Object, topic As HTMLHtmlElement
Dim i As Integer
Set http = CreateObject("MSXML2.XMLHTTP")
http.Open "GET", " False
http.send
html.body.innerHTML = http.responseText

Set topics = html.getElementsByClassName("comuni")
i = 2
For Each topic In topics

Debug.Print titleElem.getElementsByTagName("a")(0).innerText
Debug.Print titleElem.getElementsByTagName("a")(0).href

i = i + 1
Next

End Sub
 
sal21 said:
save the complete formated page, in C:\MYDIR\test.txt

Code:
Dim objHttp As Object, strURL As String

strURL = "[blue][URL unfurl="true"]http://www.codicecatastale.it/regione/abruzzo[/URL][/blue]"

Set objHttp = CreateObject("MSXML2.ServerXMLHTTP")

objHttp.Open "GET", strURL, False
objHttp.setRequestHeader "User-Agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)"
objHttp.Send ("")

Open "[blue]C:\MYDIR\test.txt[/blue]" For Output As #1
Print #1, objHttp.responseText
Close #1

Set objHttp = Nothing

---- Andy

"Hmm...they have the internet on computers now"--Homer Simpson
 
tks andy.
now from the new file i need to get all href value only in table "comuni
 
You keep adding requirements to your original post.
You asked: "i need to save the complete formated html page, in C:\MYDIR\test.txt"
The code above does that.

Case closed.

---- Andy

"Hmm...they have the internet on computers now"--Homer Simpson
 
>i need to save the complete formated html page
>now from the new file i need to get all href value only in table "comuni"

As ever you seem to have decided on a solution to some unspecified requirement that doesn't - to an outside observer - make sense

Why do you need a local copy of the page? You can get all the hrefs from the online webpage, as indeed your parsehtml post should do (if you make Andy's correction and remove the trailing / from the URL). Mind you that code does seem to be a work in progress, there are clear remnants of earlier iterations
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top