-
I'm using the code below to show a printer dialog, then print out the contents of a richtextbox. Although this works, the default paper size used is 'letter' whereas I want it to be 'A4'. So what I want to do is make the paper size in the properties screen of the print dialog to default to 'A4' rather than letter. How do I do this? I tried adding a "Printer.PaperSize=vbPRPSA4" before
the ShowPrinter call, but that didn't work.
Any ideas?
----- code snippet ------
CommonDialog1.CancelError = True
CommonDialog1.Flags = cdlPDReturnDC + cdlPDNoPageNums
If msg.SelLength = 0 Then
CommonDialog1.Flags = CommonDialog1.Flags + cdlPDAllPages
Else
CommonDialog1.Flags = CommonDialog1.Flags + cdlPDSelection
End If
On Error Resume Next
CommonDialog1.ShowPrinter
If Err <> 32755 Then ' if cancel wasn't selected
Printer.Print ""
Richtextbox1.SelPrint CommonDialog1.hDC
End If
Printer.EndDoc
---------------------------
-
I suspect that, Letter size is the defualt for the printer.
Before opening the dialog try this.
Code:
Printer.PaperSize = 9