Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to print a web page 1

Status
Not open for further replies.

janelim

Programmer
May 4, 2000
2
MY
Hi!<br><br>I used VB web browser control to browse through Internet and download the page. But I don't know how to print the page. I want to make my Print function as IE5 Print function. How can I do that?<br><br>Thank you very much!
 
This piece of code opens the IE print dialog to print the currently viewed webpage in a Web Browser. Please note, you must change the 2 pieces of red code to the name of your Web Browser.

Dim eQuery As OLECMDF 'return value type for QueryStatusWB
On Error Resume Next
eQuery = WebBrowserName.QueryStatusWB(OLECMDID_PRINT) 'get print command status
If Err.Number = 0 Then
If eQuery And OLECMDF_ENABLED Then
WebBrowserName.ExecWB OLECMDID_PRINT, OLECMDEXECOPT_PROMPTUSER, &quot;&quot;, &quot;&quot; 'Ok to Print?
Else
MsgBox &quot;The Print command is currently disabled.&quot;
End If
End If
If Err.Number <> 0 Then MsgBox &quot;Print command Error: &quot; & Err.Description
On Error GoTo 0

Jonathon.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top