
Script Error Or No Script Error That Is The Question
Hmm...
I have the following object embedded in my asp page...
<object id="IEWB" width=0 height=0
classid="clsid:8856F961-340A-11D0-A96B-00C04FD705A2"></object>
I have the following code embedded into my asp page...
Sub PrintPage()
Dim blnChoice, intCopies, intCtr
intCopies = InputBox("How many copies would you like to print?",
"Printing...", "1")
If (intCopies = "") Then
Exit Sub
End If
If (IsNumeric(intCopies) = False) Then
Exit Sub
End If
If (CInt(intCopies) < 1) Then
MsgBox "Total number of copies must be more than 0, print aborted.",
vbExclamation + vbOkOnly, "Print Cancelled"
Exit Sub
End If
' OLECMDID_PRINT = 6
' OLECMDEXECOPT_DONTPROMPTUSER = 2
' OLECMDEXECOPT_PROMPTUSER = 1
Document.Body.Focus()
'On Error Resume Next
For intCtr = 1 To intCopies
'IEWB.ExecWB OLECMDID_PRINT, 2, 1
IEWB.ExecWB 6, 2, 1
Next
If (Err.Number <> 0) Then
blnChoice = MsgBox("There was an error sending your report to the
printer, would you like to retry?", vbYesNo, "Printer Error")
If (blnChoice = vbYes) Then
PrintPage
End If
Else
MsgBox "The report has been sent to the printer."
End If
End Sub
If I open the report (web asp page) that contains this page using
Window.Open "ThisPageName.asp", it works fine and dandy, AND I can print the
report correctly WITHOUT a dialog box popping up. Now, what I can't do is
get this page to print when it is opened with the Window.showModalDialog
"ThisPageName.asp" method. Nor with Window.showModelessDialog.
Why and what are my options (printing without the print dialog box in an asp
page).
Mythran