Webbrowser control - Saving a web page 
Author Message
 Webbrowser control - Saving a web page

I have a requirement to run a webbrowser control which does a Google search
daily and saves
the search result page to a file (can be text or html).

I use the code

WebBrowser1.ExecWB OLECMDID_SAVEAS, OLECMDEXECOPT_DONTPROMPTUSER,
"d:\temp\test4.html"

This brings up the saveas box with the correct filename already filled in
and the file type as html
but how do I press the 'Save' button in code to automatically save the file.

Thanks - Mike.



Wed, 29 Jun 2005 07:55:36 GMT  
 Webbrowser control - Saving a web page
Hi Mike,

I don't think we should programmatically invoke the save button. After all,
it is the client user who determines where or whether to save the file. Try
SendKeys which might help. HTH.

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



Sat, 02 Jul 2005 09:26:57 GMT  
 Webbrowser control - Saving a web page



Quote:
> Hi Mike,

> I don't think we should programmatically invoke the save button. After
all,
> it is the client user who determines where or whether to save the file.
Try
> SendKeys which might help. HTH.

> Regards,
> Yan Liu
> This posting is provided "AS IS" with no warranties, and confers no
rights.

Hi Yan Liu,

Thanks for the response. In this particular project, my program has to send
a Search request at regular intervals, and save the resulting responses in a
log file for later checking.

However, I have managed to copy the webbrowser document to a string which I
can then save in VB as a .html file, so do not need to worry about the
'Save' button.

Thanks - Mike.



Sat, 02 Jul 2005 11:02:30 GMT  
 Webbrowser control - Saving a web page
Hi Mike,

 last week's posting

Quote:
> However, I have managed to copy the webbrowser document to a string which I
> can then save in VB as a .html file, so do not need to worry about the
> 'Save' button.

sounds very interesting to me, since it represents exactly a problem
that i'm confronted with too. What is the way you made it?

Best regards

JF



Tue, 05 Jul 2005 23:18:17 GMT  
 Webbrowser control - Saving a web page


Quote:
> Hi Mike,

>  last week's posting

> > However, I have managed to copy the webbrowser document to a string
which I
> > can then save in VB as a .html file, so do not need to worry about the
> > 'Save' button.

> sounds very interesting to me, since it represents exactly a problem
> that i'm confronted with too. What is the way you made it?

I use the following:-

strSave="D:\Temp\Myfile.htm"

strHTML = WebBrowser1.Document.body.innerHTML

Open strSave For Output As #1

Print #1, strHTML

Close #1

This seems to work fine, and you can open the html file in d:\temp by just

clicking on it. (Note this does not save pictures, only the html string).

Best regards - Mike

Penrith, NSW, Australia



Wed, 06 Jul 2005 05:33:02 GMT  
 
 [ 5 post ] 

 Relevant Pages 

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

2. Saving web page with images using the WebBrowser control

3. Saving web pages with WebBrowser control

4. Saving a complete Web Page from the WebBrowser control

5. new problem of webbrowser control save web page

6. webbrowser control save web page

7. WebBrowser Ctl: save web page to local machine

8. Save WebBrowser's web page

9. Help saving web page with web control?

10. Directly referencing an element on a web page in the WebBrowser control

11. Saving Pages Using the WebBrowser Control ???

12. How to capture Web Page to Bitmap with Webbrowser control

 

 
Powered by phpBB® Forum Software