Solved

How to get specific Printer name in Commondialog Name Box

Posted on 2002-05-19
7
209 Views
Last Modified: 2007-12-19
When I launch:
commondialog1.showprinter
how do I get a specific printer name to appear in the
printer NAME box.
?
0
Comment
Question by:rbend
  • 4
  • 2
7 Comments
 
LVL 12

Expert Comment

by:roverm
ID: 7019523
Hi (again)!

I found a very good article about setting the default printer:

http://www.freevbcode.com/ShowCode.Asp?ID=641

This is also a good solution for your other question, I will post it there as well.

It uses the ini file to change the default printer and broadcasts the change to all applications.

D'Mzzl!
RoverM
0
 

Author Comment

by:rbend
ID: 7019717
roverm:
The code you sited does change the default printer. That's good. But it does not tell me what the original printer was. Therefore, I can't change it back.
0
 
LVL 12

Expert Comment

by:roverm
ID: 7019731
Yep you can!
You can alter the class module to read the default printer first.
I will take a look also. "I'll be back..." ;-)

D'Mzzl!
RoverM
0
Industry Leaders: 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!

 
LVL 12

Accepted Solution

by:
roverm earned 50 total points
ID: 7019733
*lol*

Some easy code to read the current printer:

Public Function GetCurrentPrinter() As String
Dim curPrinter As Printer
   
    Set curPrinter = Printer
    Debug.Print curPrinter.DeviceName
    GetCurrentPrinter = curPrinter.DeviceName
   
    Set curPrinter = Nothing
End Function

D'Mzzl!
RoverM
0
 
LVL 9

Expert Comment

by:Valliappan AN
ID: 7020952
Well, thats a good link, which hope, I have been using for some time, to change the default printer.

BTW, In case of Commondialog, you could have a look at this:
http://www.devx.com/premier/mgznarch/getstarted/1999/gs299/psgs299.pdf

It states, you set TrackDefault property to True, gets the defa. printer name to Common dialog. Setting it to false, gets the recently used printer. Also, PrinterDefault property set to True makes the selected printer to default printer, if I understood right.

Hope it helps,
Cheers.
0
 

Author Comment

by:rbend
ID: 7021585
you worked hard and covered my need.
Thanks
0
 
LVL 12

Expert Comment

by:roverm
ID: 7021973
Thanks!

D'Mzzl!
RoverM
0

Featured Post

Independent Software Vendors: 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

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
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…
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…

749 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