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

Hello,
I am in need of some help. I have searched this group and found a macro that
has allowed me to print to a certain printer, even if it is the default one.
However I wish to expand on it to allow me to chose how many copies I want
and whether I want it double sided.
I have found that if I use copies:=# in the programing, I can have a button
work, but I don't want to make seperate macro buttons for 1x 2x 3x ... 6x.
I have not been able to find how to double-side print. I have my default for
that printer double-side, but it does not always do this. :(

So in final, summary.
I want to have the page print to a certain printer, which is working inside
the macro okay (automatically switches and then returns to default printer,
as required). Once the macro is pressed an option pops up for number of
copies. Double-sided will be within the macro program.

Hope that explains it. Regards Kevin.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,203
Default Printing Via By Macro for Network Printer

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.

"Kev - Radio Man" wrote:

Hello,
I am in need of some help. I have searched this group and found a macro that
has allowed me to print to a certain printer, even if it is the default one.
However I wish to expand on it to allow me to chose how many copies I want
and whether I want it double sided.
I have found that if I use copies:=# in the programing, I can have a button
work, but I don't want to make seperate macro buttons for 1x 2x 3x ... 6x.
I have not been able to find how to double-side print. I have my default for
that printer double-side, but it does not always do this. :(

So in final, summary.
I want to have the page print to a certain printer, which is working inside
the macro okay (automatically switches and then returns to default printer,
as required). Once the macro is pressed an option pops up for number of
copies. Double-sided will be within the macro program.

Hope that explains it. Regards Kevin.

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


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
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 01:17 PM.

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"