Port 属性

       

返回一个 String 值,表明指定的打印机的端口名称。只读。

expression.Port

expression   必需。返回“Applies To”列表中的一个对象的表达式。

示例

下面的示例将显示系统中所有可用打印机的有关信息。

Dim prtLoop As Printer

For Each prtLoop In Application.Printers
    With prtLoop
        MsgBox "Device name: " & .DeviceName & vbCr _
            & "Driver name: " & .DriverName & vbCr _
            & "Port: " & .Port
    End With
Next prtLoop