WebBrowser Ctl: save web page to local machine 
Author Message
 WebBrowser Ctl: save web page to local machine

Hi,
   The question is about the WebBrowser control. I intend to save a web page
to my machine by trying the following command:

    Me.WebBrowser1.Navigate (" http://www.*-*-*.com/ ")
    WebBrowser1.ExecWB OLECMDID_SAVE, OLECMDEXECOPT_DODEFAULT,
"c:\web\a.htm", ""

However, all fail.

Could you please give me a example ?

Thanks in advance!

Peter Lin



Tue, 28 Dec 2004 09:14:07 GMT  
 WebBrowser Ctl: save web page to local machine
As far as I know you can't state a path for where the file(s) will be
saved.  The following line will give you a file save box to save all
the files (page and graphics etc)

WebBrowser1.ExecWB OLECMDID_SAVE, OLECMDEXECOPT_DODEFAULT, "", ""

If you want to save just the html of the page then use something like

WebBrowser1.Document.body.outerhtml

I hope that helps

Grant

Quote:

> Hi,
>    The question is about the WebBrowser control. I intend to save a web page
> to my machine by trying the following command:

>     Me.WebBrowser1.Navigate ("http://www.microsoft.com")
>     WebBrowser1.ExecWB OLECMDID_SAVE, OLECMDEXECOPT_DODEFAULT,
> "c:\web\a.htm", ""

> However, all fail.

> Could you please give me a example ?

> Thanks in advance!

> Peter Lin



Wed, 29 Dec 2004 16:28:43 GMT  
 WebBrowser Ctl: save web page to local machine
Hello Peter,

Try the following...

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

Private Sub Command1_Click()
    URLDownloadToFile 0, "http://www.microsoft.com", "c:\web\a.htm", 0, 0
End Sub

--
Parker Zhang
Microsoft Developer Support

This posting is provided "AS IS" with no warranties, and confers no rights.



Fri, 31 Dec 2004 13:04:06 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Creating Text File on Client's Local Machine When Accessing Web Default Page

2. Using WebBrowser ctl to navigate to a local file

3. Saving web pages to file using webBrowser or inet control

4. Saving web page with images using the WebBrowser control

5. Saving web pages with WebBrowser control

6. Saving a complete Web Page from the WebBrowser control

7. Webbrowser control - Saving a web page

8. Save WebBrowser's web page

9. new problem of webbrowser control save web page

10. webbrowser control save web page

11. Saving w/ WebBrowser ctl

12. W B Ctl - Comms From Web Page To VB App

 

 
Powered by phpBB® Forum Software