使用VBA安装打印机 [英] Install Printer with VBA
问题描述
大家好,
我真的可以为此提供一些帮助.我需要通过VBA安装打印机.例如,该端口将是名称为C:\ My Documents的本地端口.它将具有PS1的打印机名称.这将使用用户可用的PS打印机驱动程序.
我到处搜寻,我感到沮丧.我看到的最接近的东西可能可以作为AddPortEx API来解决问题,但我只是不知道如何开始.
感谢您提供任何信息.
更新:
我仍在进行一些研究,发现可以通过使用批处理脚本来完成.好像字符串看起来像这样:
Good day all,
I could really use some help with this. I need to install a printer via VBA. The port will be a Local Port with the name of C:\My Documents for example. It will have a printer name of PS1. This will use a PS printer driver that is available to the user.
I''ve searched all over and i am getting frustrated. The closest thing that i saw that might do the trick as the AddPortEx API, but i just dont know how to start.
Thanks for any info.
UPDATE:
I am still doing some research and found that this could be done by using a batch script. Seems like the string would look something like this:
rundll32 printui.dll,PrintUIEntry /if /b "Test Printer" /c\\SERVER /f "%windir%\inf\ntprint.inf" /r "lpt1:" /m "AGFA-AccuSet v52.3"
我该如何满足我的要求?
端口名称:C:\ My Documents
打印机名称:PS1
打印机驱动程序:PS打印机
感谢您的帮助.
How could i incorportate my requirements to this?
Port Name: C:\My Documents
Printer Name: PS1
Printer Driver: PS Printer
Thanks for your help.
推荐答案
^ ](Paul Carmen回答),您将发现一个安全的代码(与vba一起使用)可以删除所有网络打印机,并且并定义一个.
此处 [
此处 [
Here[^] (Paul Carmen answer) you''ll find a peace of code (working with vba) to remove all network printers and and define one.
Here[^] you''ll find an answer how to display "Add printer" dialogbox with vba, using SendKeys function.
Here[^] is the ms social technet site, where you''ll find more informations about "add printer"...
这篇关于使用VBA安装打印机的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!