Link to home
Start Free TrialLog in
Avatar of mi5
mi5

asked on

Changing printer settings

Using 'form1.print' I can print the contents of a form. How do I show the user the printer dialog box so that they can select a printer and change the print options?
ASKER CERTIFIED SOLUTION
Avatar of fbtcell
fbtcell

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of MitchBroadhead
MitchBroadhead

remember to use the cancel error:

on error resume next
diagsys.CancelError = true
diagsys.caption = "Print something"
diagsys.showprinter

if err = 0 then
    Printfile(diagsys.Filename)
else
    'Cancel button was pressed
endif
 
Oh yeah

the printewr dialog just sets printer = to the printer in question

so just use printer.print
Avatar of mi5

ASKER

How do I use this dialog to change the printer settings and print the contents of my form on the selected printer?
form1.PrintForm

The printer should have already been selected by the print dialog box (otherwise the cancel error would have been raised)
The final code should look like this:

sub cmdPrintForm_Click()

on error resume next

diagsys.CancelError = true
diagsys.caption = "Print something"
diagsys.showprinter

if err = 0 then
    form1.PrintForm
else
    'Cancel button was pressed
endif

end sub