Results 1 to 3 of 3

Thread: Save a webpage to a HTML file?

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    May 2000
    Location
    Kalix, Norrbotten, SWEDEN
    Posts
    343

    Question

    Hi!

    Anyone know how to save a webpage to a HTML file stored on my computer? Can this be done with the Microsoft Internet Controls (A ref, not a control)?

    This should be done without any msgbox ,etc....

    /Smirre

    Visual Basic
    C, C++
    Java
    Access
    SQL Server

    MCP, MCSD

  2. #2
    Member
    Join Date
    Apr 2000
    Location
    Birmingham UK
    Posts
    50

    Red face

    hi yes you can do it with IE5.ocx in VB , what you need to do is right click on the page you want and then save it in a folder , remember this ocx is the same ocx like IE5


    i hope this helps


    InfoWarrior
    Waheed Rafiq (ICT Technician):
    Network +

  3. #3
    Guest
    Well, after about 2 minutes of sitting and using my brain I came up with up with an idea.

    Retrieve -> HTML Source -> Write to file -> .htm (or .html).

    ^I thought of all this..all by myself!

    And you said referenced? Ok.

    Code:
    Dim ie As New InternetExplorer
    
    Private Sub Command1_Click()
         Dim strHTML As String
         strHTML = ie.Document.documentElement.innerHTML
    
         Open "C:\htmlfile.htm" For Output As #1
              Print #1, strHTML
         Close #1
    End Sub
    But you'd have to go to the page first.

    If you would rather not go to the page first, you could look into the URLDownloadToFile API function.

    Code:
    DownloadFile "http://www.vb-world.net", "c:\vbworld.htm"
    But I like the first way better, I think it'd be much quicker. Plus, you could always keep the referenced browser's visibility to false and just surf to it and get it's source. I think it'd be much quicker than using the API function.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width