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, "", "" 'Ok to Print?
Else
MsgBox "The Print command is currently disabled."
End If
End If
If Err.Number <> 0 Then MsgBox "Print command Error: " & Err.Description
On Error GoTo 0
Jonathon.