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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

IE print websites ( .ExecWB page setup?)

Status
Not open for further replies.

bartrein

Programmer
Sep 22, 2008
49
EU
HI

I have the following function that allows printing internet websites. It works fine however i can't find anything that would help me to define print out settings on the fly (e.g. fit to 1 page change orientation to landscape etc).
I couldn't find anything amongst .ExecWB arguments maybe i am missing something here?

many thanks for your help

Function PrintFromWebsite(sURL As String)

On Error GoTo errorhandler:

Const OLECMDID_PRINT = 6
Const OLECMDEXECOPT_DONTPROMPTUSER = 2
Const PRINT_WAITFORCOMPLETION = 2

Dim objIE As Object

Set objIE = CreateObject("InternetExplorer.Application")


With objIE

.navigate sURL
Do While .ReadyState <> 4

Loop
.Visible = True
.ExecWB OLECMDID_PRINT, OLECMDEXECOPT_DONTPROMPTUSER

End With



Exit Function

errorhandler:
MsgBox "Website could not be opened due to the folllowing error" & _
vbNewLine & Err.Description, vbExclamation, "ERROR"

End Function
 
Have you tried to use OLECMDEXECOPT_PROMPTUSER (1) instead ?

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Thanks PHV, and do you know by any chance how to set up this things without user prompt?

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top