ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   word more intelligent than excel??? (https://www.excelbanter.com/excel-programming/322441-word-more-intelligent-than-excel.html)

Bill Kuunders

word more intelligent than excel???
 
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



keepITcool

word more intelligent than excel???
 
Bill,

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

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

that function will give you exactly what you want.



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


Bill Kuunders wrote :

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


Bill Kuunders

word more intelligent than excel???
 
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

"keepITcool" wrote in message
ft.com...
Bill,

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

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

that function will give you exactly what you want.



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


Bill Kuunders wrote :

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





All times are GMT +1. The time now is 03:24 PM.

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