Solved

How to get specific Printer name in Commondialog Name Box

Posted on 2002-05-19
7
207 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
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.

 
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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
VBA color chart bars 12 86
Windows 10 start screen issues 9 55
vb6 connector to mongodb 2 84
vbModal 12 53
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…
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…
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…
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…

809 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