VB 调出 打印 对话框,怎样做到点了 取消 按钮就不打印了

2024年11月20日 10:37
有2个网友回答
网友(1):

To Enable or Disable Notifications of Completed Print Jobs
Click Start, and then click Printers and Faxes.
On the File menu, click Server Properties.
On the Advanced click the options you want to apply:
Show informational notifications for local printers. This option notifies users when a job is printed on a printer that is attached to this computer.
Show informational notifications for network printers. This option notifies users of this computer when a job is printed on a remote computer.
For client computers that are running versions of Windows earlier than Microsoft Windows 2000 that access the printers on this computer, there are additional configuration options to choose from:
Notify when remote documents are printed. This option sends a message to the user who sent a job to a printer that is attached this computer.
Notify computer, not user, when remote documents are printed. This option sends a message to the computer from which the print job was sent, regardless of which computer on which the sending user is currently logged on.

网友(2):

Private Sub Command1_Click()
Dim i As Integer
Dim str As String
' 设置打印“取消”为 True
CommonDialog1.CancelError = True'必须先调出本控件
On Error GoTo Er
CommonDialog1.ShowPrinter '调用打印机窗口
str = "这里是打印内容"
Printer.FontName = "黑体"
Printer.FontSize = 26
For i = 1 To 5
Printer.Print str
Printer.Print "第 " & Printer.Page & "页"
Printer.NewPage
Next
Printer.EndDoc
Exit Sub
Er:
MsgBox "用户取消打印"
Exit Sub
End Sub