Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
RMS RMS is offline
external usenet poster
 
Posts: 4
Default Printing Problem

I have two shared printers on two seperate hard wired networked, desktop
computers. One prints tractor fed labels for Serums, and one prints
instructions on regular letter paper.

The patient information is entered on a laptop which connects wirelessly to
the newtork. I use an Excel Macro assigned to two different buttons to
select the proper printer and the range to print. This setup works
great....Until I introduce a second laptop, using the same Excel version
(2007) and same code.

Both laptops access each printer perfectly for printing the "Test Page".
However the Printer Macros on one or the other laptops fails to work. If I
re-record the marcos they work again. (Manual Printing works fine always)

On careful examination of the macro code, I find that the "ne03", for
example, has changed to "ne05" in the new code on the printer line. What
would be a strategy to avoid having to re-record the macros?

Thanks-a very puzzled RMS




  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Printing Problem

Well I could find several solutions to your problem. For example this is a
part of code that by "brute force" selects the propper printer:
(from: http://www.tek-tips.com/viewthread.cfm?qid=879030)
---

Function NetworkPrinter(ByVal myprinter As String)
On Error Resume Next
Dim NetWork As Variant
Dim X As Integer
'/// Define NetWork Array \\\
NetWork = Array("Ne00:", "Ne01:", "Ne02:", "Ne03:", "Ne04:", _
"Ne05:", "Ne06:", "Ne07:", "Ne08:", _
"Ne09:", "Ne10:", "Ne11:", "Ne12:", _
"Ne13:", "Ne14:", "Ne15:", "Ne16:", _
"LPT1:", "LPT2:", "File:", "SMC100:")
'Setup printer to Print
X = 0
TryAgain:
On Error Resume Next
'Printer
Application.ActivePrinter = myprinter & Prt_On & NetWork(X)
If Err.Number < 0 And X < 16 Then
X = X + 1
GoTo TryAgain
ElseIf Err.Number < 0 And X 15 Then
GoTo PrtError
End If
On Error GoTo 0
NetworkPrinter = myprinter & Prt_On & NetWork(X)
errorExit:
Exit Function
PrtError:
'no printer found
NetworkPrinter = ""
Resume errorExit
End Function

---
So the idea here would be that you instead of setting dirrectly the name,
invoke this function with just the printer name,

but maybe a better approach would be to check for the name in the list of
printers. How to get a list of printers? Try analyze this code - you can
modify it easily to return the propper name...
(from http://www.ozgrid.com/forum/showthread.php?t=20182)
---
Sub get_printers()

On Error Resume Next

Set WshNetwork = CreateObject("WScript.Network")
Set oPrinters = WshNetwork.EnumPrinterConnections
For i = 0 To oPrinters.Count - 1 Step 1
Cells(i + 1, 1) = " Port " & oPrinters.Item(i) & " = " & oPrinters.Item(i + 1)
Next
End Sub
---

best regards,
Leo


"RMS" wrote:

I have two shared printers on two seperate hard wired networked, desktop
computers. One prints tractor fed labels for Serums, and one prints
instructions on regular letter paper.

The patient information is entered on a laptop which connects wirelessly to
the newtork. I use an Excel Macro assigned to two different buttons to
select the proper printer and the range to print. This setup works
great....Until I introduce a second laptop, using the same Excel version
(2007) and same code.

Both laptops access each printer perfectly for printing the "Test Page".
However the Printer Macros on one or the other laptops fails to work. If I
re-record the marcos they work again. (Manual Printing works fine always)

On careful examination of the macro code, I find that the "ne03", for
example, has changed to "ne05" in the new code on the printer line. What
would be a strategy to avoid having to re-record the macros?

Thanks-a very puzzled RMS




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
Excel 2003 printing problem--printing 1 document on 2 pages Bons Excel Discussion (Misc queries) 0 December 24th 09 04:15 PM
Printing problem Dr Fumanchu Excel Discussion (Misc queries) 1 February 27th 08 01:54 PM
Printing Problem Mamaschantz Charts and Charting in Excel 1 September 11th 07 04:33 PM
Printing Problem Mike Baker Excel Discussion (Misc queries) 1 April 23rd 05 01:17 AM
Printing problem Newsgirl Excel Discussion (Misc queries) 1 April 22nd 05 05:51 PM


All times are GMT +1. The time now is 01:42 PM.

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"