Macro not working on other peoples computers

J

JonathanW

Hi I have a macro that prints to one specific printer on the network so one
person can file all the quotes people enter. Other computers but not mine,
mine is the emailpc. All computers have the printer driver. Its a peer to
peer network. I think it has something to do with the Ne09 what does that
mean? Would anyone be able to tell me what I have to change to make it work
on all computers?

The code is:

Application.ActivePrinter = "\\EMAILPC\HP LaserJet 2100
Series PS on Ne09:"
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
 
D

Dave Peterson

On one of the troublesome pcs, try changing the printer manually--just to see
what it is. You could even record a macro when you do it in excel.

If the only difference is the number in the Ne## string, maybe you could use
something like:

Option Explicit
Sub testme()
Dim iCtr As Long
Dim FoundIt As Boolean
Dim CurPrinter As String

CurPrinter = Application.ActivePrinter

FoundIt = False
For iCtr = 0 To 99
On Error Resume Next
Application.ActivePrinter = "\\EMAILPC\HP LaserJet 2100 Series PS on Ne" _
& Format(iCtr, "00") & ":"
If Err.Number = 0 Then
FoundIt = True
Exit For
Else
'keep looking
Err.Clear
End If
Next iCtr
On Error GoTo 0

If FoundIt = False Then
MsgBox "No printer close to that name"
Else
'do the real work
'and change it back
Application.ActivePrinter = CurPrinter
End If
End Sub



======
You may want to save what was the current printer before you change, too. Then
change back to that when you're done.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top