Solved

Changing printer options w/o user input

Posted on 1998-08-18
5
123 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

772 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now