ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Dealing with 3 Printer Ports (https://www.excelbanter.com/excel-programming/340819-dealing-3-printer-ports.html)

Brad

Dealing with 3 Printer Ports
 
Hello,

My spreadsheet prints to a color printer for my users. Between the 4 users,
there was only 2 printer ports that it had to deal with ne01 and ne02. Now we
just added another user and they printer to ne04. How do I change my code to
accomodate this 3rd printer port. My code is below for the printing portion.
Thanks.

---
On Error Resume Next
Application.ActivePrinter = "HP Color LaserJet P_30 on Ne01:"
If Err.Number = 1004 Then
Application.ActivePrinter = "HP Color LaserJet P_30 on Ne02:"
Err.Clear
End If

William[_2_]

Dealing with 3 Printer Ports
 
Maybe this helps....

Sub test()
Dim i As Integer, x As String
On Error Resume Next
i = 0
For i = 1 To 4
x = "HP Color LaserJet P_30 on Ne0" & i & ":"
Application.ActivePrinter = x
If Application.ActivePrinter = x Then Exit Sub
Next i
End Sub

--


XL2003
Regards

William



"Brad" wrote in message
...
Hello,

My spreadsheet prints to a color printer for my users. Between the 4
users,
there was only 2 printer ports that it had to deal with ne01 and ne02. Now
we
just added another user and they printer to ne04. How do I change my code
to
accomodate this 3rd printer port. My code is below for the printing
portion.
Thanks.

---
On Error Resume Next
Application.ActivePrinter = "HP Color LaserJet P_30 on Ne01:"
If Err.Number = 1004 Then
Application.ActivePrinter = "HP Color LaserJet P_30 on Ne02:"
Err.Clear
End If





All times are GMT +1. The time now is 07:13 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com