Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() I have an issue with printing an order form to one of two network printers (both same model). The first goes to Production control (never a problem there) and the second to Supply. originally, I thot this may have been a glitch stemming from when our printer LAN went down last week. However, for some reason, the Supply printer's address keeps shifting around. Originally, this is what I used in my form (the bold part is what keeps changing): Application.ActivePrinter = "\\123.123.123.123\(103) LM T632 on Ne02:" 'Set & print to Production Control ActiveWindow.SelectedSheets.PrintOut Copies:=1, ActivePrinter:= _ "\\123.123.123.123\(103) LM T632 on Ne02:", Collate:=True Application.ActivePrinter = "\\123.123.123.123\(123) LM T632 on *Ne02*:" 'Set & print to Supply ActiveWindow.SelectedSheets.PrintOut Copies:=1, ActivePrinter:= _ "\\123.123.123.123\(123) LM T632 on *Ne02*:", Collate:=True At some point, last week, *Ne02* changed to *Ne04* for the Supply Printer, while all else remained the same. Then people began reporting that they weren't getting a copy at Supply. I couldn't figure out why, until after a couple of days, when I decided to record a macro to troubleshoot the address and saw the change. I then changed the macro to reflect the new address -- end of problem. Just the other day, I was informed that once again, printouts weren't appearing at Supply. I then recorded another macro and found that *Ne04* had changed to *Ne02*. I updated the script and all was fine until tonight. This time, the address has shifted, from *Ne02* to *Ne03*. Questions: Why would this change, apparently at random? Is it due to someone inadvertantly resetting the router perhaps? Is there a way to lock down this Ne0x part? Conversely, is there a method in calling out the IP address that I can use that will always find the printer, regardless of the Ne0x? TIA -- AH·C ------------------------------------------------------------------------ AH·C's Profile: http://www.excelforum.com/member.php...o&userid=29108 View this thread: http://www.excelforum.com/showthread...hreadid=490684 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Dim i as Long, sStr as String
On Error Resume Next for i = 0 to 9 sStr = "\\123.123.123.123\(103) LM T632 on Ne0" & i & ":" Application.ActivePrinter = 0 if err.Number = 0 then exit sub else err.clear end if Loop On Error goto 0 ActiveWindow.SelectedSheets.PrintOut Copies:=1, ActivePrinter:= _ sStr, Collate:=True -- Regards, Tom Ogilvy "AH·C" wrote in message ... I have an issue with printing an order form to one of two network printers (both same model). The first goes to Production control (never a problem there) and the second to Supply. originally, I thot this may have been a glitch stemming from when our printer LAN went down last week. However, for some reason, the Supply printer's address keeps shifting around. Originally, this is what I used in my form (the bold part is what keeps changing): Application.ActivePrinter = "\\123.123.123.123\(103) LM T632 on Ne02:" 'Set & print to Production Control ActiveWindow.SelectedSheets.PrintOut Copies:=1, ActivePrinter:= _ "\\123.123.123.123\(103) LM T632 on Ne02:", Collate:=True Application.ActivePrinter = "\\123.123.123.123\(123) LM T632 on *Ne02*:" 'Set & print to Supply ActiveWindow.SelectedSheets.PrintOut Copies:=1, ActivePrinter:= _ "\\123.123.123.123\(123) LM T632 on *Ne02*:", Collate:=True At some point, last week, *Ne02* changed to *Ne04* for the Supply Printer, while all else remained the same. Then people began reporting that they weren't getting a copy at Supply. I couldn't figure out why, until after a couple of days, when I decided to record a macro to troubleshoot the address and saw the change. I then changed the macro to reflect the new address -- end of problem. Just the other day, I was informed that once again, printouts weren't appearing at Supply. I then recorded another macro and found that *Ne04* had changed to *Ne02*. I updated the script and all was fine until tonight. This time, the address has shifted, from *Ne02* to *Ne03*. Questions: Why would this change, apparently at random? Is it due to someone inadvertantly resetting the router perhaps? Is there a way to lock down this Ne0x part? Conversely, is there a method in calling out the IP address that I can use that will always find the printer, regardless of the Ne0x? TIA -- AH·C ------------------------------------------------------------------------ AH·C's Profile: http://www.excelforum.com/member.php...o&userid=29108 View this thread: http://www.excelforum.com/showthread...hreadid=490684 |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Tom, thanks for the assist. I'm almost there. One thing I had to do was change "Loop" to "Next" to agree with the "For" statement. However, now it just loops to the end and returns Ne09, even tho I know for a fact that it should be Ne03 at this point. Unfortunately, I have no clue as to what the the bold part are supposed to do in the following lines: For ... *Application.ActivePrinter = 0*If *Err.Number = 0* Then Exit SubElse*Err.Clear*End IfNext*On Error GoTo 0* I'll keep poking at it, but hope someone, anyone can square this up. TIA -- AH·C ------------------------------------------------------------------------ AH·C's Profile: http://www.excelforum.com/member.php...o&userid=29108 View this thread: http://www.excelforum.com/showthread...hreadid=490684 |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Tom, altho I still don't know what *Err.Number* & *Err.Clear* is all about, I made your script work as follows: Dim i As Long, xUNC As String, rUNC As String On Error Resume Next For i = 0 To 9 xUNC = "\\123.123.123.123\(103) LM T632 on Ne0" & i & ":" Application.ActivePrinter = xUNC If Err.Number = 0 Then 'if UNC is valid, print ActiveWindow.SelectedSheets.PrintOut Copies:=1, ActivePrinter:= _ xUNC, Collate:=True 'Print this sheet @ Supply rUNC = xUNC 'in case you want to store & reuse the printer's UNC later on MsgBox ("And this little piggy went to " & xUNC & " @ Supply") Else Err.Clear End If Next On Error GoTo 0 Again, thanks for pointing me in the right direction :) -- AH·C ------------------------------------------------------------------------ AH·C's Profile: http://www.excelforum.com/member.php...o&userid=29108 View this thread: http://www.excelforum.com/showthread...hreadid=490684 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
members on my network printer not able to print to default printer | Excel Discussion (Misc queries) | |||
How do I send a spreadsheet to a printer outside the network? | Excel Discussion (Misc queries) | |||
Skittish Ne0x address on network printer | Excel Programming | |||
selecting network printer | Excel Programming | |||
Network address not Local Address | Excel Programming |