Solved

Changing printer options w/o user input

Posted on 1998-08-18
5
124 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

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

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

Suggested Solutions

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…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

777 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