Set Printer Defaults - Really important

Posted on 2006-05-31
Medium Priority
Last Modified: 2012-05-05
Can I use a VBS / WSH script to set a default printer AND what the default orientation and paper size should be ?


\\server\printer1      landscape       A4.

etc ?
Question by:MarionTaylor

Expert Comment

ID: 16804952
Yes, you can use wsh to set a default printer:

    Dim oWsh As Object
    Set oWsh = CreateObject("Wscript.Network")
    Call oWsh.SetDefaultPrinter("Printer A")

But I don't think you can use it to set default orientation and paper size of the printer. To achieve that goal, you need to use a set of Printer Control APIs.
LVL 15

Accepted Solution

JackOfPH earned 2000 total points
ID: 16805043
HOWTO: Open the Printer Properties Dialog

HOWTO: Set Which Printer Is the System Default Printer

HOWTO: Use GetDeviceCaps to Determine Margins on a Page

HOWTO: Connect to a Network Printer with the Win32 API

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses
Course of the Month15 days, 6 hours left to enroll

839 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