We need you!

We're working hard on the next version of Developer Fusion. Let us know what you think we should be up to!

Members

Technology Zones

Articles

Hosted By

MaximumASP

Info

Rated
Read 15,868 times

Related Categories

Printing from the WebBrowser Control

vrallon

There are a number of ways to print the current document from the WebBrowser control. The simplest is to use the ExecWB command:

WebBrowser1.ExecWB OLECMDID_PRINT, OLECMDEXECOPT_PROMPTUSER

An alternative method is to use the ExecScript method of the document's window object:
1. get a reference to the document
2. get a reference to the document's window object
3. then use ExecScript to run the "window.print();" JScript:

set doc=webbrowser.document
set win=doc.parentWindow
win.execScript "window.print();","JScript"

You can use ExecScript to run any client-side scripts from within VB.

Visit my site at http://brains-for-hire.com and http://salveon.net.

Comments