There are four label boxes at the top left corner and four label boxes at the top right corner of my form. And then nearer to the center of the form a picture box and at the bottom a command button to print. BY using PrintForm method if i take printout in a A4 sheet the whole form printed within Half of the page. So I want to format it to print in the entire paper as a neat format. Got it?
Thanks, that's much clearer.
I think you might have to print the controls yourself, to the Printer object. For example, here's a very crude Sub which you can pass a form to, and it will attempt to print all labels and picture boxes on the form... Have a play with this, you should be able to adjust the scaling and so on. When I tried it it worked, but came out a bit funny.
- Public Sub PrintThisForm(frm As Form)
-
Dim ctl As Control
-
With Printer
-
.Orientation = vbPRORPortrait
-
Printer.Scale (0, 0)-(frm.ScaleWidth, frm.ScaleHeight)
-
For Each ctl In frm.Controls
-
If TypeOf ctl Is Label Then
-
.CurrentX = ctl.Left
-
.CurrentY = ctl.Top
-
.Font = ctl.Font
-
.ForeColor = ctl.ForeColor
-
Printer.Print ctl.Caption
-
ElseIf TypeOf ctl Is PictureBox Then
-
.PaintPicture ctl.Image, ctl.Left, ctl.Top
-
End If
-
Next
-
.EndDoc
-
End With
-
End Sub