Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Set a printer as the default printer

Posted on 2001-06-13
3
Medium Priority
?
233 Views
Last Modified: 2010-05-02
How is it possible to set (by code and not using a common dialog) a printer as the default printer?
0
Comment
Question by:BrainStorm
3 Comments
 
LVL 5

Accepted Solution

by:
GeoffKell earned 200 total points
ID: 6184785
0
 
LVL 1

Expert Comment

by:ahmadpj
ID: 6184884
This is the answer:
add a listbox and add this code:

Dim P As Printer
 For Each P In Printers
 List1.AddItem P.DeviceName
Next

'after that, the user cans select one of them, then:

Private Sub List1_Click()
 Dim P As Printer
 For Each P In Printers
   If P.DeviceName = List1.Text Then
      Set Printer = P
      Exit For
   End If
 Next

 'now selected printer is the default printer
 Printer.Print "MY TEXT"
 Printer.EndDoc
End Sub
0
 

Expert Comment

by:Mike Johnson
ID: 14812510
what is the "Printer" object... how do i reference it?
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
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 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 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…
Suggested Courses

971 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