ActivePrinter 属性(Excel)Application.ActivePrinter property (Excel)

返回或设置活动打印机的名称。Returns or sets the name of the active printer. 读/写 StringRead/write String.



expression:表示 Application 对象的变量。expression A variable that represents an Application object.


本示例显示当前打印机的名称。This example displays the name of the active printer.

MsgBox "The name of the active printer is " & Application.ActivePrinter

上面的示例可用于在您的计算机上发现正确的打印机和端口命名约定,以便在下面的示例中使用。The preceding example can be used to discover the proper printer and port naming conventions on your computer for use in the following example.

本示例更改活动打印机。This example changes the active printer. 在需要端口名称之后的冒号 ":"。The colon ":" after the port name is required.

Application.ActivePrinter = "[The name of your printer] on [port]:"  
Application.ActivePrinter = "Canon Printer on Ne02:"

支持和反馈Support and feedback

有关于 Office VBA 或本文档的疑问或反馈?Have questions or feedback about Office VBA or this documentation? 请参阅 Office VBA 支持和反馈,获取有关如何接收支持和提供反馈的指南。Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.