private sub command1_click()
dim beginpage, endpage, numcopies, orientation, i
commondialog1.cancelerror = true
on error goto errhandler
commondialog1.showprinter
beginpage = commondialog1.frompage
endpage = commondialog1.topage
numcopies = commondialog1.copies
orientation = commondialog1.orientation
for i = 1 to numcopies
next
exit sub
errhandler:
exit sub
end sub