How to get specific Printer name in Commondialog Name Box

When I launch:
commondialog1.showprinter
how do I get a specific printer name to appear in the
printer NAME box.
?
rbendAsked:
Who is Participating?
 
rovermConnect With a Mentor Commented:
*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
 
rovermCommented:
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
 
rbendAuthor Commented:
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
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
rovermCommented:
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
 
Valliappan ANSenior Tech ConsultantCommented:
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
 
rbendAuthor Commented:
you worked hard and covered my need.
Thanks
0
 
rovermCommented:
Thanks!

D'Mzzl!
RoverM
0
All Courses

From novice to tech pro — start learning today.