Solved

Changing printer options w/o user input

Posted on 1998-08-18
5
125 Views
Last Modified: 2010-04-30
I need to be able to edit printer properties without the user intervening.  Specifically, I need to be able to change the network port.  (aka Queue name).  Any help??
0
Comment
Question by:bmullins
  • 3
  • 2
5 Comments
 
LVL 1

Accepted Solution

by:
jsuper earned 50 total points
ID: 1429567
Just use the printer object to change the properties of the default printer.   For example, Printer.port = 2.  Use the visual basic object browser to look at the "Printer" object.  It should be a piece of cake.
0
 

Author Comment

by:bmullins
ID: 1429568
Ok, more clearly,  I need to pull in a list of all installed printers, then change each one individually.  (i.e.  if printer.port = "1" then printer.port = "2").

Sorry should have been more clear
0
 
LVL 1

Expert Comment

by:jsuper
ID: 1429569
Use the Printers collection.  Every printer available to the system is contained in the printers object.  For example...

Dim vPrinter as Printer
For each vPrinter in Printers
   vprinter.port = 2
   '  Any other settings you want to change...
next vprinter

Is that what you wanted?
0
 

Author Comment

by:bmullins
ID: 1429570
Yes, but when I try:   Printer.Port = 2 or Printer.Port = "2" I get "Wrong number of arguments.  I think I'm just going use the loop to read the old port then write the new port to the Registry key:  "HKEY_LOCAL_MACHINE\System\CurrentControlSet\control\Print\Printers\" & X.DeviceName, "Port"

Can you not define these properties using a simple Printer.Port = "x"??
0
 
LVL 1

Expert Comment

by:jsuper
ID: 1429571
Unforunately, the printer port is a read only property that returns a string such as "LPT1:" or "LPT2:".  I would try your registry idea and see how it goes.   Good Luck.
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

791 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question