Script Error Or No Script Error That Is The Question 
Author Message
 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



Mon, 20 Dec 2004 05:15:16 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. VB Scripting Question -- "On Error"

2. ADO error error seems to have stopped (JScript) script with ERRORLEVEL=0

3. Client Side question: Trap Scripting Errors

4. Internet Explorer script error question

5. VB / Script Encoder question for the MVP Scripting team

6. questions on passing text parameter from server script to client script (some new findings)

7. questions on passing parameter from server script to client script

8. VBScript 5.5 Crashes on Script Error in Script Event

9. 'Remote Scripting Error: Page invoked does not support remote scripting

10. Error: ActiveX Scripting was not able to initialize the script execution engine

11. VBScript 5.5 Crashes on Script Error in Script Event

12. Locking error, DataControl Error, or am I stupid ?

 

 
Powered by phpBB® Forum Software