Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 74
Default Change to different active printers on different PC's

Hi,

Win XP Professional SP2
Excel 2003

I've been browsing through this forum, but couldn't find any usefull
info for my problem.

I have (for the moment) 3 PC's where i need to print to the same
multitray network printer.
I've setup different printers on one PC (testing purpose) so that i
can change from tray by changing the active printer.
As seen in a lot of previous answers, the printer name is followed
with a "on Nexx:"
This is a local number, so i guess it would be different on each PC.
The utility ( .XLT) i would like to run is located on a server, so by
clicking on a shortcut on one of those PC's i'll open the Excel
utility. This singe utility is easy in maintenance than installing it
on all those different PC's.

Depending on certain criteria, i need to print on white OR yellow
paper (tray1 or tray2), thats why i need to setup different printers
on those PC's.

So my question is:
How can i retreive the Nexx: number automaticly for those 2 printers
on those 3 different PC's, witouth hardcoding it?
The printernames a
Kyocera FS-3900DN KX FAT AV Tray1
Kyocera FS-3900DN KX FAT AV Tray2

I found this code, but can't get it working, think i need to select a
reference in the VBA editor, but don't know witch one.

Function GetPrinterPort(printer As String) As String
CreateObject ("RegObj.Registry")
Dim objReg As RegObj.Registry
Dim objRootKey As RegObj.RegKey
Dim sKey As String
Dim objVal As RegObj.RegValue
Dim sData As String
Dim vData As Variant

sKey = "\HKEY_CURRENT_USER\Software\Microsoft\Windows NT
\CurrentVersion\Devices\"
Set objReg = New RegObj.Registry
Set objRootKey = objReg.RegKeyFromString(sKey)

For Each objVal In objRootKey.Values
If objVal.Name = sPrinterName Then
sData = objVal.Value
Exit For
End If
Next objVal

If Len(sData) 0 Then
vData = Split(sData, ",")
GetPrinterPort = vData(UBound(vData))
Else
GetPrinterPort = ""
End If

Set objReg = Nothing

End Function


Any help welcome
Best regards,
Ludo
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,203
Default Change to different active printers on different PC's

A little searching around lead me he
http://support.microsoft.com/default.aspx/kb/297292?p=1
it may be that you need the file available there to set the library
reference needed and use your code. Untested - theory only!

"Ludo" wrote:

Hi,

Win XP Professional SP2
Excel 2003

I've been browsing through this forum, but couldn't find any usefull
info for my problem.

I have (for the moment) 3 PC's where i need to print to the same
multitray network printer.
I've setup different printers on one PC (testing purpose) so that i
can change from tray by changing the active printer.
As seen in a lot of previous answers, the printer name is followed
with a "on Nexx:"
This is a local number, so i guess it would be different on each PC.
The utility ( .XLT) i would like to run is located on a server, so by
clicking on a shortcut on one of those PC's i'll open the Excel
utility. This singe utility is easy in maintenance than installing it
on all those different PC's.

Depending on certain criteria, i need to print on white OR yellow
paper (tray1 or tray2), thats why i need to setup different printers
on those PC's.

So my question is:
How can i retreive the Nexx: number automaticly for those 2 printers
on those 3 different PC's, witouth hardcoding it?
The printernames a
Kyocera FS-3900DN KX FAT AV Tray1
Kyocera FS-3900DN KX FAT AV Tray2

I found this code, but can't get it working, think i need to select a
reference in the VBA editor, but don't know witch one.

Function GetPrinterPort(printer As String) As String
CreateObject ("RegObj.Registry")
Dim objReg As RegObj.Registry
Dim objRootKey As RegObj.RegKey
Dim sKey As String
Dim objVal As RegObj.RegValue
Dim sData As String
Dim vData As Variant

sKey = "\HKEY_CURRENT_USER\Software\Microsoft\Windows NT
\CurrentVersion\Devices\"
Set objReg = New RegObj.Registry
Set objRootKey = objReg.RegKeyFromString(sKey)

For Each objVal In objRootKey.Values
If objVal.Name = sPrinterName Then
sData = objVal.Value
Exit For
End If
Next objVal

If Len(sData) 0 Then
vData = Split(sData, ",")
GetPrinterPort = vData(UBound(vData))
Else
GetPrinterPort = ""
End If

Set objReg = Nothing

End Function


Any help welcome
Best regards,
Ludo
.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,549
Default Change to different active printers on different PC's


An alternative is to allow the user to specify the printer...
Application.Dialogs(xlDialogPrinterSetup).Show
--
Jim Cone
Portland, Oregon USA
(Special Sort info... http://www.contextures.com/excel-sort-addin.html)





"Ludo"
wrote in message ...
Hi,
Win XP Professional SP2
Excel 2003

I've been browsing through this forum, but couldn't find any usefull
info for my problem.

I have (for the moment) 3 PC's where i need to print to the same
multitray network printer.
I've setup different printers on one PC (testing purpose) so that i
can change from tray by changing the active printer.
As seen in a lot of previous answers, the printer name is followed
with a "on Nexx:"
This is a local number, so i guess it would be different on each PC.
The utility ( .XLT) i would like to run is located on a server, so by
clicking on a shortcut on one of those PC's i'll open the Excel
utility. This singe utility is easy in maintenance than installing it
on all those different PC's.

Depending on certain criteria, i need to print on white OR yellow
paper (tray1 or tray2), thats why i need to setup different printers
on those PC's.

So my question is:
How can i retreive the Nexx: number automaticly for those 2 printers
on those 3 different PC's, witouth hardcoding it?
The printernames a
Kyocera FS-3900DN KX FAT AV Tray1
Kyocera FS-3900DN KX FAT AV Tray2

I found this code, but can't get it working, think i need to select a
reference in the VBA editor, but don't know witch one.

Function GetPrinterPort(printer As String) As String
CreateObject ("RegObj.Registry")
Dim objReg As RegObj.Registry
Dim objRootKey As RegObj.RegKey
Dim sKey As String
Dim objVal As RegObj.RegValue
Dim sData As String
Dim vData As Variant

sKey = "\HKEY_CURRENT_USER\Software\Microsoft\Windows NT
\CurrentVersion\Devices\"
Set objReg = New RegObj.Registry
Set objRootKey = objReg.RegKeyFromString(sKey)

For Each objVal In objRootKey.Values
If objVal.Name = sPrinterName Then
sData = objVal.Value
Exit For
End If
Next objVal

If Len(sData) 0 Then
vData = Split(sData, ",")
GetPrinterPort = vData(UBound(vData))
Else
GetPrinterPort = ""
End If

Set objReg = Nothing

End Function


Any help welcome
Best regards,
Ludo
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 74
Default Change to different active printers on different PC's

On 22 apr, 17:42, "Jim Cone" wrote:
An alternative is to allow the user to specify the printer...
* *Application.Dialogs(xlDialogPrinterSetup).Show
--
Jim Cone
Portland, Oregon *USA
(Special Sort info...http://www.contextures.com/excel-sort-addin.html)

<SNIP

Hi all,

Thanks a lot for the proposals.
Just because i don't want to change manual that i would like to do it
full automaticly.
By changing the search criteria a found something that i can use.
see:
http://groups.google.be/group/micros...77945c c740c1

Works great.
Now still need to test in reality.
I hope only that, when changing to another active printer and a slow
network, that the page is printed on the right printer and not to the
previous one due to the slow network connection.

By this, following question:
Is it possible to read the printer status before printing start?

for example:
I change the active printer from printer A to Printer B
I read the 'ready' status from printer B until this one is ready.
When printer B is ready, then print.

any answer welcome.

Best regards,
Ludo


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
macros in excel on one pc won't appear in other pc's, why? Rick in Colorado Excel Discussion (Misc queries) 1 January 17th 06 10:27 PM
how to synch VBA Moduals between PC's dfav Excel Programming 1 December 1st 04 09:37 PM
Change Printers in VBA Bill Agee Excel Programming 1 November 1st 04 09:02 PM
Commands fail on different PC's Jacky Excel Programming 1 August 19th 04 10:16 AM
ListBox size change on different PC's PeterN Excel Programming 1 April 29th 04 10:04 PM


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

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"