ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Macro not working on other peoples computers (https://www.excelbanter.com/excel-discussion-misc-queries/144636-macro-not-working-other-peoples-computers.html)

JonathanW

Macro not working on other peoples computers
 
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

Dave Peterson

Macro not working on other peoples computers
 
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.



JonathanW wrote:

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


--

Dave Peterson


All times are GMT +1. The time now is 12:24 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com