print macro

R

rbemmer

Is there a way to write a macro that will change the default printer on my
local machine to a network printer ie... \\server\printer?
 
R

rbemmer

Here's the code I'm using. Even with \\Server\Printer in the code the macro
still prints to my local default printer instead of the network printer.

For i = 1 To 99
Err.Clear
On Error Resume Next
Application.ActivePrinter = "\\SRVR01\Estimates on Ne0" & 1 & "."
If Err.Number = 0 Then Exit For
 
J

JLGWhiz

Don's suggestion will probably be your best bet to get the exact printer
address. You can take a shortcut and just set the printer up manually, then
run this lilltle snippet to see what the address looks like:

Sub prtTest()
MsgBox ActivePrinter
End Sub
 
J

JLGWhiz

"\\SRVR01\Estimates on Ne0" & 1 & "."

Should this not be "\\SRVR01\Estimates on Ne0" & i & ":"

i instead of 1 and colon instead of period?
 
R

rbemmer

i = var
Each client's printer address is different when printing to the server. The
"Ne0i" looks for that var. The prtTest() displays the address to the default
printer on that local machine. What I'm looking for is a way to change the
default printer to a network printer, print my spreadsheet, then change back
to the local default printer.
 
J

JLGWhiz

I understand the i variable, but you used a 1 when you concatenated the Ne0
and you used a periord (.) instead of a colon:)). If you used the period in
your actual code, it could affect the results. Sometimes the typos can be
as devastating as bad code.
 
J

JLGWhiz

"Each client's printer address is different when printing to the server"

I am not sure what you mean by this statement. The Ne01, Ne02, etc. are
intranet ports and I don't know that they would need 99 ports to handle the
print demands. But I am not a techie, so what do I know. I just don't
recall ever seeing more that two ports for network printers on a single
workstation.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top