Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

show printing preferences dialog box 2

Status
Not open for further replies.

petevick

Technical User
Jul 25, 2001
131
0
0
GB
I would like to show the printing preferences dialog box for the default printer from within my application. I'm guessing its going to be an API call, but for the life of me I can't find any info on this subject. Any one got a clue for me ??
 
won't the dialog box control do for asking the printing options? thru project/components add microsoft common dialog contol 6.0 to your project. now, from the toolbox, add it to your form. and put a command control also on your form. in the click event of your command button, add this code, (dialog box control is named dialog1)


dialog1.showprinter


will the dialog box that comes up do for your purpose?
 
Thanks for the replies guys, I'll check out your link ca8msm. teresachristy, I am using VB reports, so printer page size has to be set to the report size before the report is shown. VB reports totally ignores anything set by printer.papersize and the common dialog control.
 
I've just followed up on your link ca8msm, its a 'nearly there' situation. The examples refuse to show the properties for my Lexmark, which is a pretty jazzy properties box, and only shows a single tab for my more standard Canon, more research required. It is definitely the PrinterProperties API call tho, I think, maybe...
 
If all the "extra" details to a specific printer do not show up you may have to include a reference to one of the DLL's for that printer. I remember on one of my old Canon's I only got a basic setup using the API, whereas if I used the Canon's DLL's I got all the options that was available in the actual canon software.
 
That sounds reasonable ca8msm, the Microsoft Support Knowledge Base even mentions that not all tabs may be visible using PrinterProperties, no clues other than that tho. I'll look into using the DLL's for the printer, thanks for the lead.
 
I've gotten a little further with this, if I use

Shell ("RUNDLL32 PRINTUI.DLL,PrintUIEntry /e /n" & Printer.DeviceName)

this works fine, the /e displays printing preferences, and the /n is followed by the printer name, Printer.DeviceName being the default printer name, one problem tho, it will not work when the printer name has spaces in it, anyone got any further ideas??
 
Just had a flash of inspiration, it hurt like hell !!. Just a slight mod to the above...

Shell ("RUNDLL32 PRINTUI.DLL,PrintUIEntry /e /n" & Chr$(34) & Printer.DeviceName & Chr$(34))

the addition of the two Chr$(34) simply puts quote marks around the printer name and hey presto it works. God I love it when a plan comes together.
 
Just one other slight mod, this is better...

x = Shell("RUNDLL32 PRINTUI.DLL,PrintUIEntry /e /n" & Chr$(34) & Printer.DeviceName & Chr$(34), vbNormalFocus)

as it ensures the preferences dialog box has focus
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top