Quantcast
Channel: VBForums - Visual Basic 6 and Earlier
Viewing all articles
Browse latest Browse all 21273

[RESOLVED] CDC Print Cancel not Working

$
0
0
When I run my code CDC ShowPrinter click cancel I get an error 32755
what am I missing please
Code:

Private Sub cmdAddress_Run()

Cancel = False
Inch = 1440
PrintCount = 0
myResetRow = 1
Dim sPage As Integer
   
'set print run
    On Error GoTo PrintError

'Set Flags then disable Option and Selection Buttons
'and Set Default Printer
  With dlgDialogs
      .CancelError = True
      .PrinterDefault = False
      .Copies = 1
    If optEnvelope.Value = True Or _
        optOneLabel.Value = True Then
        .Flags = cdlPDHidePrintToFile Or _
                cdlPDNoSelection Or _
                cdlPDNoPageNums
    ElseIf optLabel.Value = True Then
      .Min = 1
      .Max = txtAddress
      .Flags = cdlPDNoSelection
      sPage = .FromPage
      ' .Flags = 0
    Else
      .CancelError = True
      .Copies = 1
      ' .Min = 1
      .Max = 10
      .FromPage = 1
      ' txtAddress holds no of pages
      'in the current print run
      .ToPage = txtAddress
      .Flags = 0
      .Flags = &H0 Or &H80000 Or &H4 Or &H100000
            If chkPages.Value = 1 Then .ShowPrinter    (Error on this line)
              On Error Resume Next
    End If
  End With
 
  'Enter Page No. to Start
      StartPage = dlgDialogs.FromPage
     
   
 'Other print code
 
 'Printing complete
 Printer.EndDoc
 Screen.MousePointer = vbDefault
 Unload Me
 
PrintError:
Dim msg As String
msg = "Note Error Number and Inform Controller"
 
  If Err.Number <> cdlCancel Then
    MsgBox "Error " & Err.Number & " : " & Err.Description & vbCrLf & msg, 64 + 0, "Error Control"
    Exit Sub
  Else
    Exit Sub
  End If
End Sub

I run the code and the printer dialog appears and if print is selected all OK but if cancel is selected
it defaults to the same line with Err.Number 32755

Viewing all articles
Browse latest Browse all 21273

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>