Folks
This is my attempt at borrowing code from other posts and trying to get it to print to different network printers and looping through to find the correct NeXX number also.
Thanks to all those I found code from.
However my problem is its ignoring it!
As far as I can tell it should be printing one copy to printer "Office" and one copy to printer "Findon" but all it does is print two copies to whatever printer I have selected in Excel at the time. Im sure its a simple fix but its doing my head in!
Thanks
Dave
This is my attempt at borrowing code from other posts and trying to get it to print to different network printers and looping through to find the correct NeXX number also.
Thanks to all those I found code from.
However my problem is its ignoring it!
As far as I can tell it should be printing one copy to printer "Office" and one copy to printer "Findon" but all it does is print two copies to whatever printer I have selected in Excel at the time. Im sure its a simple fix but its doing my head in!
Thanks
Dave
Code:
Const Office As String = "[URL="file://virgo/cewp0009"]\\virgo\cewp0009[/URL] on "
Const Findon As String = "[URL="file://ps1921na001/ps1921nm010"]\\ps1921na001\ps1921nm010[/URL] on "
Sub lllllllll()
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:", "Ne17:", "Ne18:", "Ne19:", "Ne20:", _
"Ne21:", "Ne22:", "Ne23:", "Ne24:", "Ne25:", "Ne26:", "Ne27:", "Ne28:", _
"Ne29:", "Ne30:", "Ne31:", "Ne32:", "Ne33:", "Ne3:", "Ne35:", "Ne36:", _
"Ne37:", "Ne38:", "Ne39:", "Ne40:", "Ne41:", "Ne42:", "Ne43:", "Ne44:", _
"Ne45:", "Ne46:", "Ne47:", "Ne48:", "Ne49:", "Ne50:", "Ne51:", "Ne52:", _
"Ne53:", "Ne54:", "Ne55:", "Ne56:", "Ne57:", "Ne58:", "Ne59:", "Ne60:", _
"Ne61:", "Ne62:", "Ne63:", "Ne64:", "Ne65:", "Ne66:", "Ne67:", "Ne68:", _
"Ne69:", "Ne70:", "Ne71:", "Ne72:", "Ne73:", "Ne74:", "Ne75:", "Ne76:", _
"Ne77:", "Ne78:", "Ne79:", "Ne80:", "Ne81:", "Ne82:", "Ne83:", "Ne84:", _
"Ne85:", "Ne86:", "Ne87:", "Ne88:", "Ne89:", "Ne90:", "Ne91:", "Ne92:", _
"Ne93:", "Ne94:", "Ne95:", "Ne96:", "Ne97:", "Ne98:", "Ne:99", "Ne100:", _
"Ne101:", "Ne102:", "Ne103:", "Ne104:", "Ne105:", "Ne106:", "Ne:107", "Ne108:", _
"Ne109:", "Ne110:", "Ne111:", "Ne112:", "Ne113:", "Ne114:", "Ne:115", "Ne116:", _
"Ne117:", "Ne118:", "Ne119:", "Ne120:", "Ne121:", "Ne122:", "Ne:123", "Ne124:", _
"Ne125:", "Ne126:", "Ne127:", "Ne128:", "Ne129:", "Ne130:", "Ne:131", "Ne132:")
'Setup printer
x = 0
TryAgain:
On Error Resume Next
Application.ActivePrinter = Office & NetWork(x)
ActiveWindow.SelectedSheets.PrintOut Copies:=1, ActivePrinter:= _
Office & NetWork(x), Collate:=True
GoTo NextPrinter
If Err.Number <> 0 And x < 132 Then
x = x + 1
GoTo TryAgain
ElseIf Err.Number <> 0 And x > 131 Then GoTo PrtError
End If
NextPrinter:
Application.ActivePrinter = Findon & NetWork(x)
ActiveWindow.SelectedSheets.PrintOut Copies:=1, ActivePrinter:= _
Findon & NetWork(x), Collate:=True
Exit Sub
PrtError:
MsgBox PROMPT:="PRINT QUEUE WAS NOT FOUND"
End Sub