ID: 418
Viewed: 2945
Added: Aug 19, 2002
Version:
Snippet uploaded by: snippet
Written By: Unknown
Demo: Sorry, no demo
Thank you for your vote. Please wait...
It appears you already voted for this snippet
It appears your vote value was empty
another way to using the common dialog for printing
Highlight all by clicking in box
<!---Declaration--->
none
Highlight All
<!---Code--->
Private Sub mnuPrint_Click()
On Error Resume Next
With dlgCommonDialog
.DialogTitle = "Print"
.CancelError = True
.Flags = cdlPDReturnDC + cdlPDNoPageNums
If RTF1.SelLength = 0 Then
.Flags = .Flags + cdlPDAllPages
Else
.Flags = .Flags + cdlPDSelection
End If
.ShowPrinter
If Err <> MSComDlg.cdlCancel Then
'Set margins
Printer.CurrentX = 1440
Printer.CurrentY = 1440
Printer.FontSize = 10
Printer.Print RTF1.Text; .hDC
Printer.EndDoc
End If
End With
End Sub
Or
' allows the user to push cancel on printer dialog
'On Error Resume Next
'With dlgCommonDialog
'.DialogTitle = "Print"
'.CancelError = True
' Prepare to print using the printer object.
'.PrinterDefault = True
' We need to know whether the user decided to print.
'.ShowPrinter
'If Err <> MSComDlg.cdlCancel Then
'Printer.CurrentX = 0.2 ' 1440 in twips is 1" margin
'Printer.CurrentY = 1.25
'Printer.FontSize = 10
Me.PrintForm
Printer.EndDoc
End If
End With;
No Comments to show
Please completely fill out the form below if you want to review this snippet. All reviews are subject to validation.
Adding your comment. Please wait...
Thanks for adding your comment!. After further review it will be added.
There was a problem adding your comment. Please try again.
Please complete all the fields in the form before sending.