Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
printer port assignment in macro
I want to access a network printer via a macro and am successful as long as I
know the current address of the printer for the specific network user. The command Application.ActivePrinter = "printername on Ne0x:" works just fine - except the printername is different on each computer and the Ne0x: (port?) changes from computer to computer, and in fact changes from time to time on a single computer. How can I code this so it will work from multiple computers all the time? |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
printer port assignment in macro
Use something like:
for i = 1 to 9 err.clear On error resume Next Application.ActivePrinter = "printername on Ne0" & i & ":" if err.Number = 0 then exit for On error goto 0 Next On Error goto 0 -- Regards, Tom Ogilvy "DaveAlbany" wrote: I want to access a network printer via a macro and am successful as long as I know the current address of the printer for the specific network user. The command Application.ActivePrinter = "printername on Ne0x:" works just fine - except the printername is different on each computer and the Ne0x: (port?) changes from computer to computer, and in fact changes from time to time on a single computer. How can I code this so it will work from multiple computers all the time? |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
printer port assignment in macro
thank you very much!
what is the purpose and need of the two On Error Goto 0 commands though? "Tom Ogilvy" wrote: Use something like: for i = 1 to 9 err.clear On error resume Next Application.ActivePrinter = "printername on Ne0" & i & ":" if err.Number = 0 then exit for On error goto 0 Next On Error goto 0 -- Regards, Tom Ogilvy "DaveAlbany" wrote: I want to access a network printer via a macro and am successful as long as I know the current address of the printer for the specific network user. The command Application.ActivePrinter = "printername on Ne0x:" works just fine - except the printername is different on each computer and the Ne0x: (port?) changes from computer to computer, and in fact changes from time to time on a single computer. How can I code this so it will work from multiple computers all the time? |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
printer port assignment in macro
You may never find a legitimate port. I always like to make sure On Error
Resume Next only refers to a specific area of code - otherwise it can mask true errors and makes debugging very difficult. -- Regards, Tom Ogilvy "DaveAlbany" wrote: thank you very much! what is the purpose and need of the two On Error Goto 0 commands though? "Tom Ogilvy" wrote: Use something like: for i = 1 to 9 err.clear On error resume Next Application.ActivePrinter = "printername on Ne0" & i & ":" if err.Number = 0 then exit for On error goto 0 Next On Error goto 0 -- Regards, Tom Ogilvy "DaveAlbany" wrote: I want to access a network printer via a macro and am successful as long as I know the current address of the printer for the specific network user. The command Application.ActivePrinter = "printername on Ne0x:" works just fine - except the printername is different on each computer and the Ne0x: (port?) changes from computer to computer, and in fact changes from time to time on a single computer. How can I code this so it will work from multiple computers all the time? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Printer Using USB Port Slows Page Setup | Excel Discussion (Misc queries) | |||
Capturing Data from a Com Port or Printer Port | Excel Programming | |||
VBA to change Button Macro assignment | Excel Programming | |||
Macro assignment disappears | Excel Programming | |||
Relative Macro Assignment | Excel Programming |