saving web pages

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have to save web pages through excel macro. The page does not contain any
web
queries. how to do this? What are all the commands to do this task?
 
What from the page do you need to save - images included for example, or
just the HTML ?

Here's a simple example of one way to do it (no error checking....)

'****************************
Sub tester()
GetContent "http://www.google.com", ThisWorkbook.Path & "\blah.html"
End Sub

Function GetContent(sURL As String, sPath As String) As String

Dim oXHTTP As Object
Dim f As Long

Set oXHTTP = CreateObject("MSXML2.XMLHTTP")
oXHTTP.Open "GET", sURL, False
oXHTTP.send

f = FreeFile

Open sPath For Output As f
Write #f, oXHTTP.responseText
Close #f


End Function
'*****************************

Tim
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top