以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  [求助]电脑联两台打印机,如何使用指定的打印机打印?  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=191263)

--  作者:薛翁19480514
--  发布时间:2024/4/7 17:33:00
--  [求助]电脑联两台打印机,如何使用指定的打印机打印?
电脑连接两台打印机:
当需要单页凭证时用激光打印机打印(已设默认打印机)
当需要两页或三页时用针式打印机压感纸打印

存在问题:
不管选那个打印机,都是电脑系统设置的默认打印机在打印
无法按需打印
请老师看看问题在哪里?
谢谢! 

打印机名称是这样得到的:
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


--  作者:有点蓝
--  发布时间:2024/4/7 20:17:00
--  
Ws.PrintOut(Preview:=False, ActivePrinter:=_Mrdyj)
--  作者:薛翁19480514
--  发布时间:2024/4/8 14:01:00
--  
谢谢,可以打印了。