#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default print macro

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?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,124
Default print macro

Have you tried recording a macro while you do it manually?

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"rbemmer" wrote in message
...
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?


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,565
Default print macro

ActivePrinter = \\Servername\PrinterName


"rbemmer" wrote in message
...
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?



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default print macro

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

"JLGWhiz" wrote:

ActivePrinter = \\Servername\PrinterName


"rbemmer" wrote in message
...
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?




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,565
Default print macro

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


"rbemmer" wrote in message
...
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

"JLGWhiz" wrote:

ActivePrinter = \\Servername\PrinterName


"rbemmer" wrote in message
...
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?








  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,565
Default print macro

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

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

i instead of 1 and colon instead of period?



"rbemmer" wrote in message
...
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

"JLGWhiz" wrote:

ActivePrinter = \\Servername\PrinterName


"rbemmer" wrote in message
...
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?






  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default print macro

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.

"JLGWhiz" wrote:

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

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

i instead of 1 and colon instead of period?



"rbemmer" wrote in message
...
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

"JLGWhiz" wrote:

ActivePrinter = \\Servername\PrinterName


"rbemmer" wrote in message
...
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?






  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,565
Default print macro

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.


"rbemmer" wrote in message
...
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.

"JLGWhiz" wrote:

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

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

i instead of 1 and colon instead of period?



"rbemmer" wrote in message
...
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

"JLGWhiz" wrote:

ActivePrinter = \\Servername\PrinterName


"rbemmer" wrote in message
...
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?








  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,565
Default print macro


"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.



"rbemmer" wrote in message
...
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.

"JLGWhiz" wrote:

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

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

i instead of 1 and colon instead of period?



"rbemmer" wrote in message
...
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

"JLGWhiz" wrote:

ActivePrinter = \\Servername\PrinterName


"rbemmer" wrote in message
...
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?








Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro to hide rows with a certain cell empty then set print area and print tahrah Excel Programming 12 January 9th 07 03:47 AM
Pivot Table macro to set print area and print details of drill down data Steve Haskins Excel Discussion (Misc queries) 2 December 28th 05 04:59 PM
Macro to open print window and set to print entire workbook retseort Excel Discussion (Misc queries) 1 October 27th 05 11:00 PM
Why does macro speed slow after Excel Print or Print Preview? Larry A[_3_] Excel Programming 6 May 16th 05 11:22 AM
Need Help w/ Print Macro to Print All Visible Sheets (including Charts) in a Workbook will Excel Programming 3 September 23rd 04 08:05 PM


All times are GMT +1. The time now is 11:30 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"