word more intelligent than excel???

B

Bill Kuunders

Working with network prionters it has been a problem to tell excel which
port the printer is on. I.e. either Ne01, Ne02, Ne03 or Ne04.

E Ehren came up with a solution ,,, looping through the possible numbers
untill there was a match. This works fine in excel.

Used the same code to prevent the problem in a word macro.
It appears that word can intuitively pick up the right number.

The word macro .................

oldpname = Application.ActivePrinter 'at this stage printer is the default
inkjet printer
__don't need this__For j = 0 To 9
__don't need this__On Error Resume Next
__don't need this__temppname = "\\nzdfprn01\Label_UHT_Sato on Ne0" & j & ":"

instead use this..................
temppname = "\\nzdfprn01\Label_UHT_Sato "
Application.ActivePrinter = temppname 'it selects the right printer here
'application
active printer is now the sato label printer on Ne03 for instance
__don't need this__If Application.ActivePrinter = temppname Then
__don't need this__Exit For
__don't need this__End If
__don't need this__Next j

printlabel
Application.ActivePrinter = oldpname
End Sub

The lines with __don't need this__ are necessary in the excel macro to be
able to find the right number.

Is there another way for excel to make it "smarter"?
I don't like to have to accept that word is smarter.


Regards
Bill Kuunders
 
K

keepITcool

Bill,

goto http://groups.google.com
search for: list-of-printers author:keepITcool

you should get a thread (this NG) from Jan22 with messageID

that function will give you exactly what you want.



--
keepITcool
| www.XLsupport.com | keepITcool chello nl | amsterdam


Bill Kuunders wrote :
 
B

Bill Kuunders

To keepITcool

Thank You very much for that code. Haven't used it yet. I'm sure it'll work.
I just wanted to find out why and how word can find the right Ne port number
without any extra code and excel does need more code like the function you
provided.

I.e.
within the two lines ........

temppname = "\\nzdfprn01\Label_UHT_Sato "
Application.ActivePrinter = temppname 'it selects the right printer

.........word identifies the active printer as \\nzdfprn01\Label_UHT_Sato on
NE03

without any extra code.

Bill Kuunders
orig from Deurne NBr
 

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

Similar Threads

selecting network printer 3
VBA to print Word Document 1
Printing Problems 1
Automated Printing 2
word to excel 1
Printing Word doc from Excel 2
copy excel to word 8
Excel to Word 2

Top