Solved

Save html file from web site with out opening browser

Posted on 2004-09-21
6
313 Views
Last Modified: 2010-05-02
ok i need to make an app that grabs a html page from a website and saves its to disk
the web site updates every few minutes
and i want my app to run in the background and grab this updated page every ... so often..
0
Comment
Question by:apinsonn
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 18

Assisted Solution

by:bobbit31
bobbit31 earned 75 total points
ID: 12113063
reference ms internet controls under project/references:

Dim IE As New InternetExplorer

IE.Navigate "www.google.com"

'wait for page to load
Do Until IE.ReadyState = READYSTATE_COMPLETE
   DoEvents
Loop

Dim strHtml as string
strHtml = IE.document.body.innerHTML

msgbox strHtml

Dim ff as integer
ff = FreeFile

Open "<path to file>" For Output as #ff
Print #ff, strHtml
Close(ff)
0
 
LVL 18

Expert Comment

by:bobbit31
ID: 12113065
and put the above in a timer
0
 
LVL 18

Expert Comment

by:bobbit31
ID: 12113109
oh and don't forget to clear resources:

set IE = nothing

0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 32

Accepted Solution

by:
Erick37 earned 75 total points
ID: 12113254
You can use the URLDownloadToFile API

Private Declare Function URLDownloadToFile Lib "urlmon" Alias _
"URLDownloadToFileA" (ByVal pCaller As Long, ByVal szURL As String, ByVal _
szFileName As String, ByVal dwReserved As Long, ByVal lpfnCB As Long) As Long

Use like this:

returnValue = URLDownloadToFile(0, "http://www.microsoft.com/ms.htm", "c:\ms.htm", 0, 0)

Reference:
How To Download a File Without Prompting
http://support.microsoft.com/default.aspx?scid=kb;en-us;244757

                        
0
 
LVL 52

Expert Comment

by:Ryan Chong
ID: 12113320
Also Ensuring URLDownloadToFile Bypasses a Cached File Copy:
http://vbnet.mvps.org/code/internet/urldownloadtofilenocache.htm
0
 

Author Comment

by:apinsonn
ID: 12113473
both work great split the points
0

Featured Post

[Live Webinar] The Cloud Skills Gap

As Cloud technologies come of age, business leaders grapple with the impact it has on their team's skills and the gap associated with the use of a cloud platform.

Join experts from 451 Research and Concerto Cloud Services on July 27th where we will examine fact and fiction.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses
Course of the Month6 days, 1 hour left to enroll

626 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question