Solved

Save html file from web site with out opening browser

Posted on 2004-09-21
6
307 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
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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
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 49

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
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.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

743 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now