There are three methods for doing this.
1. Sending ^p key, using SendKeys, which is not really clean programming :P
2. Using the shell command, and rundll32
Shell "rundll32.exe C:\WINDOWS\SYSTEM\MSHTML.DLL,PrintHTML " & _ "http://www.developerfusion.com"
, vbMinimizedFocus
3. Finally, method 3, which I think is the best method, and uses the built-in
commands for the web-browser. Private Sub PrintUserPage()
'navigate to the page you want
'you can delete this if you want to print the current page
WebBrowser1.Navigate ("http://www.developerfusion.com/")
DoEvents
'print
WebBrowser1.ExecWB OLECMDID_PRINT, OLECMDEXECOPT_DONTPROMPTUSER
'you can change OLECMDEXECOPT_DONTPROMPTUSER to OLECMDEXECOPT_PROMPTUSER if you
wish
End Sub
Comments