电脑连接两台打印机:
当需要单页凭证时用激光打印机打印(已设默认打印机)
当需要两页或三页时用针式打印机压感纸打印
存在问题:
不管选那个打印机,都是电脑系统设置的默认打印机在打印
无法按需打印
请老师看看问题在哪里?
谢谢!
打印机名称是这样得到的:
Dim printers As WinForm.ComboBox = e.Form.Controls("ComboBox1")
Dim clist As String = "默认打印机"
For Each p As String In InstalledPrinters
clist = "|" & p
Next
printers.ComboList = clist
打印机名称存在全局代码 _Mrdyj
…………
Book.Save(pfile) '保存工作簿
If _Mrdyj = "默认打印机" Then
Dim Proc As New Process
Proc.File = pfile
Proc.Verb = "Print" '指定动作
Proc.Start()
Else
' MessageBox.Show(_Mrdyj) ’测试是否进入目的打印机
Dim App As New MSExcel.Application
Dim Wb As MSExcel.WorkBook = App.WorkBooks.Open(pfile)
Dim Ws As MSExcel.WorkSheet = Wb.WorkSheets(1)
wb.saved = True
App.DisplayAlerts = False
App.Visible = True
Ws.PrintOut(Preview:=False, ActivePrinter:=" & _Mrdyj & ") '直接打印;
App.Quit
End If