Application.ActivePrinter 属性 (Excel)

返回或设置活动打印机的名称。 读/写 String

语法

表达式ActivePrinter

expression:表示 Application 对象的变量。

示例

本示例显示当前打印机的名称。

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

前面的示例可用于发现计算机上正确的打印机和端口命名约定,以便在以下示例中使用。

本示例更改活动打印机。 端口名称后面的冒号“:”是必需的。

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

支持和反馈

有关于 Office VBA 或本文档的疑问或反馈? 请参阅 Office VBA 支持和反馈,获取有关如何接收支持和提供反馈的指南。