Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / February 2005

Tip: Looking for answers? Try searching our database.

word is smarter than excel?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Bill Kuunders - 05 Feb 2005 21:05 GMT
The code below is for an excel routine to find the port number for a network
printer.
The portnumbers are selected at random when logging on to the network.
For us it is normally ne01 ne02 ne03 or ne04

Dim OldPname As String
Dim TempPname As String
OldPname = Application.ActivePrinter
For J = 0 To 99
On Error Resume Next
If J < 10 Then
TempPname = "Adobe PDF on Ne0" & J & ":"
Application.ActivePrinter = TempPname
ElseIf J >= 10 Then
TempPname = "Adobe PDF on Ne" & J & ":"
Application.ActivePrinter = TempPname
End If
If Application.ActivePrinter = TempPname Then
Exit For
End If
Next J
Application.ActivePrinter = "TempPname"
ThisWorkbook.Worksheets(1).PrintOut , Copies:=1,ActivePrinter: _ =TempPname,
Collate:=True
Application.ActivePrinter = OldPname

The code works perfect.
My question is..............
Why does word not need to go through the loop of allocating numbers until
there is a match?

In word these two lines return the right printer including the right port

TempPname = "Adobe PDF "
Application.ActivePrinter = TempPname

Do I really have to admit that word is smarter than excel?

Regards
Bill Kuunders
Jezebel - 05 Feb 2005 21:32 GMT
The difference must lie elsewhere. VBA is exactly the same in both cases --  
literally: it's the same library.

> The code below is for an excel routine to find the port number for a
> network printer.
[quoted text clipped - 36 lines]
> Regards
> Bill Kuunders
Bill Kuunders - 06 Feb 2005 09:28 GMT
It would be great to find out.
Bill K

> The difference must lie elsewhere. VBA is exactly the same in both
> cases --  literally: it's the same library.
[quoted text clipped - 39 lines]
>> Regards
>> Bill Kuunders
Bill Kuunders - 07 Feb 2005 10:00 GMT
From an excel expert.........  Tom Ogilvy

Yes, word is smarter.  Printing is through the application, not VBA and
excel needs the port.

Signature

Regards,
Tom Ogilvy

> It would be great to find out.
> Bill K
[quoted text clipped - 43 lines]
>>> Regards
>>> Bill Kuunders
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.