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

How can i print web page with Print Dialog box in new window.

Status
Not open for further replies.

mohanq

Technical User
Jun 12, 2002
8
0
0
US

Hi,

I would like print web page with out print dialog box in a new window. I got a problem when i click on print link, it raises an error "access denied: WB.ExecWB".

I tried with following snippet:-

<HTML>
<HEAD>
<script language=&quot;VBScript&quot;>
Sub myPrint()
OLECMDID_PRINT = 6
OLECMDEXECOPT_DONTPROMPTUSER = -1
WB.ExecWB OLECMDID_PRINT,OLECMDEXECOPT_DONTPROMPTUSER
End Sub
</script>
</HEAD>
<body>
<OBJECT ID=&quot;WB&quot; CLASSID=&quot;clsid:8856F961-340A-11D0-A96B-00C04FD705A2&quot; width=&quot;1&quot; height=&quot;1&quot; VIEWASTEXT></OBJECT>
<a href=&quot;javascript:myPrint();&quot;>Print</a>
</body>
</html>

could u pls let me know who knows how to resolve the problem.

Thanks in advance
 
There Is A Issue With Trying To Pass Your &quot;JavaScript:myPrint();&quot; To The Object. This Code Should Work For You.

<HTML>
<HEAD>
<OBJECT ID=&quot;WB&quot; Width=&quot;0&quot; Height=&quot;0&quot; ClassID=&quot;clsid:8856F961-340A-11D0-A96B-00C04FD705A2&quot;></OBJECT>
<SCRIPT Language=&quot;VbScript&quot;>
FUNCTION myPrint()
OLECMDID_PRINT = 6
OLECMDEXECOPT_DONTPROMPTUSER = 2
OLECMDEXECOPT_PROMPTUSER = 1
WB.ExecWB OLECMDID_PRINT, OLECMDEXECOPT_DONTPROMPTUSER
END FUNCTION
</SCRIPT>
</HEAD>
<BODY>
<INPUT Type=&quot;button&quot; Value=&quot;Print&quot; Id=&quot;button&quot; Name=&quot;button&quot; OnClick=&quot;myPrint()&quot;>
</BODY>
</HTML>

Hope This Helps.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top