kwitcom
asked on
VBScript in ASP to print page. Need help making it print more copies.
I need to make this code print 2 copies and also make it print 4 copies.
label.asp
<script language="VBScript">
SUB Print()
OLECMDID_PRINT = 6
OLECMDEXECOPT_DONTPROMPTUS ER = 2
OLECMDEXECOPT_PROMPTUSER = 1
'Bring focus to the document so that it will be what prints:
document.body.focus()
'Call the "Print" command. Since the Internet Explorer/DOM didn't add
'the "print()" method until 5.0
on error resume next
call IEWB.ExecWB (OLECMDID_PRINT, -1)
if err.number <> 0 then
alert "Nothing Printed"
end if
location.replace("index.as p")
END SUB
</script>
<body onload="print()">
<object id="IEWB" width="0" height="0" classid="clsid:8856F961-34 0A-11D0-A9 6B-00C04FD 705A2">
</object>
label.asp
<script language="VBScript">
SUB Print()
OLECMDID_PRINT = 6
OLECMDEXECOPT_DONTPROMPTUS
OLECMDEXECOPT_PROMPTUSER = 1
'Bring focus to the document so that it will be what prints:
document.body.focus()
'Call the "Print" command. Since the Internet Explorer/DOM didn't add
'the "print()" method until 5.0
on error resume next
call IEWB.ExecWB (OLECMDID_PRINT, -1)
if err.number <> 0 then
alert "Nothing Printed"
end if
location.replace("index.as
END SUB
</script>
<body onload="print()">
<object id="IEWB" width="0" height="0" classid="clsid:8856F961-34
</object>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
<script language="VBScript">
SUB Print()
OLECMDID_PRINT = 6
OLECMDEXECOPT_DONTPROMPTUS
OLECMDEXECOPT_PROMPTUSER = 1
'Bring focus to the document so that it will be what prints:
document.body.focus()
'Call the "Print" command. Since the Internet Explorer/DOM didn't add
'the "print()" method until 5.0
on error resume next
for i = 1 to 4
call IEWB.ExecWB (OLECMDID_PRINT, -1)
next
if err.number <> 0 then
alert "Nothing Printed"
end if
location.replace("index.as
END SUB
</script>
<body onload="print()">
<object id="IEWB" width="0" height="0" classid="clsid:8856F961-34
</object>