Hello,
I have a form I am designing and have a print button, that I need to open the print dialoge box, but it is not working, I am using VB6. Can someone help a poor boy out. I am new, so I am probably, if not definately forgetting something.
I'm not sure what you are trying, but this works for me. Remember to include a CommonDialog object on your form.
Private Sub cmdPrint_Click()
Dim BeginPage, EndPage, NumCopies, i, x
' Set Cancel to True
CommonDialog1.CancelError = True
CommonDialog1.Orientation = cdlLandscape
On Error GoTo ErrHandler
' Display the Print dialog box
CommonDialog1.ShowPrinter
' Get user-selected values from the dialog box
BeginPage = CommonDialog1.FromPage
EndPage = CommonDialog1.ToPage
NumCopies = CommonDialog1.Copies
For i = 1 To NumCopies
Printer.FontSize = 10
If CommonDialog1.Orientation = cdlPortrait Then
Printer.Orientation = vbPRORPortrait
Else
Printer.Orientation = vbPRORLandscape
End If
Printer.Print Now
Printer.Print
Printer.Print
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.