返回一個 String 值,表明指定的打印機的端口名稱。只讀。
expression.Port
expression 必需。返回“應(yīng)用于”列表中的一個對象的表達式。
下面的示例將顯示系統(tǒng)中所有可用打印機的有關(guān)信息。
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