LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default Printing Via By Macro for Network Printer

JLatham thanks for your reply.
This is the code I used. Could you please advise the best position to insert
your code?

Sub Print_Log()
Dim str As String
Dim strNetworkPrinter As String
str = Application.ActivePrinter

strNetworkPrinter = GetFullNetworkPrinterName("\\nzsaklprint\pr07b22")
If Len(strNetworkPrinter) 0 Then
Application.ActivePrinter = strNetworkPrinter
ActiveSheet.PrintOut Copies:=1
End If

Application.ActivePrinter = str
End Sub


Function GetFullNetworkPrinterName(strNetworkPrinterName As String) As String
Dim strCurrentPrinterName As String, strTempPrinterName As String, i As
Long
strCurrentPrinterName = Application.ActivePrinter
i = 0
Do While i < 100
strTempPrinterName = strNetworkPrinterName & " on Ne" & Format(i,
"00") & ":"
On Error Resume Next ' try to change to the network printer
Application.ActivePrinter = strTempPrinterName
On Error GoTo 0
If Application.ActivePrinter = strTempPrinterName Then
GetFullNetworkPrinterName = strTempPrinterName
i = 100 ' makes the loop end
End If
i = i + 1
Loop
Application.ActivePrinter = strCurrentPrinterName ' change back to
the original printer
End Function

Regards Kevin.

"JLatham" wrote:

For the number of copies, you just need a couple of lines of code near the
beginning like:

Dim NumCopies As Integer
NumCopies = InputBox("Enter # of Copies to print:", "Print Copies", 0)
If NumCopies = 0 Then
Exit Sub ' gives you a chance to quit by entering zero
End If
'... your existing code, just use NumCopies with
'the copies:= portion, as copies:=NumCopies
'
I'm not certain you can provide the instruction to print duplex - you might
record a macro while doing it manually and take a look at the code generated.


 
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
Printing macro i network Mia Excel Programming 7 March 2nd 10 06:07 PM
Creating a macro to print to file when printing to another printer [email protected] Excel Programming 1 July 12th 08 09:04 PM
members on my network printer not able to print to default printer smeheut Excel Discussion (Misc queries) 0 June 18th 07 06:42 PM
Choosing printer in a printing macro Werner[_18_] Excel Programming 1 July 5th 05 04:52 PM
Choosing printer in a printing macro \Jean-Jerome Doucet via OfficeKB.com\ Excel Programming 2 July 5th 05 04:31 PM


All times are GMT +1. The time now is 06:00 AM.

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

About Us

"It's about Microsoft Excel"