Home |
Search |
Today's Posts |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Printing macro i network | Excel Programming | |||
Creating a macro to print to file when printing to another printer | Excel Programming | |||
members on my network printer not able to print to default printer | Excel Discussion (Misc queries) | |||
Choosing printer in a printing macro | Excel Programming | |||
Choosing printer in a printing macro | Excel Programming |